-
Notifications
You must be signed in to change notification settings - Fork 95
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
Nodes incorrectly matched when selector starts above passed in context #92
Comments
I'll have a look at this when I'm home next week. |
This may relate to the nature of QSA. It effectively queries the whole document and then filters for descendants. 1 === document.documentElement.querySelectorAll('html body').length whereas 0 === jQuery('html').find('html body').length Based on jsfiddle.../1 qwery matches like QSA even with |
Thanks for the info @ryanve, that zepto discussion is quite interesting; sounds like there's a general agreement that qSA has a spec bug on this issue. The link to the article about :scoped is particularly interesting. It actually wouldn't be hard to change to match the jQuery behaviour on this as we already have element id rewriting in place for relationship-first selectors (e.g. The element id rewriting works like this, if required:
If we did this for all queries that involved a custom context/root then we'd be automatically restricting queries to children of that element, no matter what the query because it's already scoped. |
The temp |
I'm happy to standardise on the Sizzle behaviour here; it's just a matter of ensuring that doing so doesn't impose large performance costs. |
The context node is ignored if a match happens that surrounds it. This is hard to explain so I wrote some code here, and a fiddle: http://jsfiddle.net/dvYmQ/
the following matches even though the entirety of the selector isn't contained inside div two
The only reason I noticed this at all is because I attempted to replace Facebook's selector engine with qwery tonight at a hackathon, and we have an explicit test case for this. I know you haven't worked on qwery in a while, but it's still tiny, and seems good, so I figured I'd try to cut us over.
I also attempted to fix so I could send you a patch, but I've been awake too long and am largely useless right now.
The text was updated successfully, but these errors were encountered: