Skip to content

Nodes incorrectly matched when selector starts above passed in context #92

Description

@tomocchino

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/

<div id="one">
  <div id="two">
    <div id="three"></div>
  </div>
</div>

the following matches even though the entirety of the selector isn't contained inside div two

var two = document.getElementById('two');
qwery('#one #three', two); // shouldn't match, but it returns [three]

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions