New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #7322. Make `.is()` with a positional selector work like delegated event logic #491

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@dmethvin
Member

dmethvin commented Sep 7, 2011

Submitted for discussion. Per #7322 and several other tickets, positional selectors have, um, unusual behavior when used with .is(). Here are some examples: http://jsfiddle.net/eJ4yd/3/ The two important changes in this patch:

  1. Make the positional selector string rooted at the jQuery object's context (usually document);
  2. Return true if the first element in the jQuery object is present in the selector results.

When refactoring the delegated event logic, I found that the event code already works this way (backed up by test cases) so it seems odd to have .is() work differently. If this patch is landed I can remove a few lines of special cases from the event handler.

And for the record, I really dislike positional selectors!

http://jqbug.com/7322

@timmywil

This comment has been minimized.

Show comment
Hide comment
@timmywil

timmywil Sep 20, 2011

Member

Landed in commit 70e2e32.

Member

timmywil commented Sep 20, 2011

Landed in commit 70e2e32.

@timmywil timmywil closed this Sep 20, 2011

mescoda pushed a commit to mescoda/jquery that referenced this pull request Nov 4, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment