I just want to add my 2 cents: In my experience there's 2 reasons to
instantiate a widget class with an element:
1. It's a single widget on the page: in which case it should probably
have a unique id and can be instantiated with var widget = new
Widget("widget_id");
2. There are numerous widgets of the same kind identified by a
className which can be instantiated with $$(".widget-
class").each(function(elemnent) { new Widget(element); });
In both cases you'd use this.element = $(element); in the initialize
method.
-- Marc
On Sep 20, 8:20 pm, kstubs <[email protected]> wrote:
> I'm always looking for the sugar T.J. I like your off-the-cuff example,
> I'll try that. Just curious, is this core worthy? Certainly the #1
> consideration would be performance, but shouldn't be any performance hit if
> no additional selector is found. The 2nd consideration would be, is it a
> strange or unusual request - so am I the only guy who wants it?
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.