Permalink
Show file tree
Hide file tree
2 comments
on commit
sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Make sure that live events bubble unless explicitly told not to, like…
… a normal event. Fixes #6182.
- Loading branch information
Showing
3 changed files
with
56 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26b0e91
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't removing the
delete matches[selector];
break theclosest
functionality when passing in an array for selector? E.g.$("#b").closest(['div']).length // == 2 now instead of 1
Now
closest
returns an array with 2 entries instead of one.I got here because the changes in 8c41325 in particular the use of
jQuery.unique(ret)
broke some of the event-unit-tests. The idea to usejQuery.unique(ret)
was ok to fix #6182 but as nowclosest
returns more then one element when an array is passed in andunique
sorts these elements in document-order this breaks the live-event-bubbling as the bubbling now happens top-down instead of bottom-up.Check the test/unit/events.js test
event: .live()/.die()
andevent: .delegate()/.undelegate()
26b0e91
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of that line was intentional - it makes it so that .closest(Array) returns all of the nodes up the tree that match those selectors -- of course this also makes the unique/sort change very much un-intentional as it breaks the desired functionality of that particular method. I've backed it out in commit 7be1120 (and added another test that covers the use case you pointed out). Thanks again!