Environment: Prototype 1.7 rc2; XAMPP on Ubutnu 10.4 (running as
VirtualBox vm); browsers: FF3.6.3 (localhost on Ubuntu 10.4); FF3.6.3
(Win XP SP3 over lan); IE8.0.6001 (Win XP SP3 over lan)

Using Element.on [$(ele).on( 'click', '.special', callback);] triggers
a callback for clicks inside of ele where ele and none of its
descendants match '.special' **IF** an ancestor of ele has the
"special" class.  The returned element for the event is that ancestor
element.  The same thing happens for other 'delegated' events.  Is
that the intended functionality?
Tracing the rc2 code, this seems to be lines 5679:5682.
handleEvent: function(event) {
 var element = event.findElement(this.selector);
 if (element) this.callback.call(this.element, event, element);
}

Should 5681:
if (element) this.callback.call(this.element, event, element);
be changed to something like:
if (element && element.descendantOf(this.element))
this.callback.call(this.element, event, element);

That check could of course be added to the callback code.  I just did
not expect event delegation to trigger and match elements outside of
the specified 'root' element.  If really do want to trigger events for
cases like this, another alternative would be so set element to
this.element, as the 'limit' for the delegation.

-- 
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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to