Ticket #12383 (closed bug: fixed)
jQuery.on() selector should only apply to descendants of the element
|Reported by:||contact@…||Owned by:|
The $.on() method accepts a CSS selector parameter in order to setup delegated event handlers.
According to the documentation, this selector only applies to descendants of the element :
A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element.
The current implementation when the event is triggered via jQuery.event.dispatch is to call $.is() in order to match the event.target and its parents. The issue with $.is() is that it will not only test for descendants, but also for parents of the element. Considering the documentation, I think this is unintuitive.
Below an example of the issue : JSBin link : http://jsbin.com/ocijif/1/embed?live
- Status changed from new to closed
- Resolution set to wontfix
- Component changed from unfiled to event
- Cc timmywil added
- Priority changed from undecided to high
- Status changed from closed to reopened
- Resolution wontfix deleted
- Milestone None deleted
- Priority changed from high to blocker
- Milestone set to 1.8.1