Skip to content
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

Recursive matcher #2 #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Inviz
Copy link

@Inviz Inviz commented Apr 22, 2011

This is a faster .match function that doesnt use .search over the document

Benchmark:

https://gist.github.com/933639

Note: My matchNode implementation uses old approach of nativeMatchSelector first and then does the recursive thing. nativeMatchSelector part may be easily removed (as shown in benchmarks)

Only these two tests fail:

expect( context.MATCH(testNode, "[attr"+ operator +"'"+ value +"']") ).toEqual(shouldBeTrue ? true : false);
and

 expect( context.MATCH(testNode, document.createElement('div')) ).toEqual(false);

Not sure what's the deal in those two failed, can you help me figure out?

@Inviz
Copy link
Author

Inviz commented Apr 22, 2011

Just for the record, matchNode here takes 3d argument. So you can do things like

 Slick.match(li, '> li+li', ul) //true

Although in this pull Slick.match is not changed to pass that third argument to matchNode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant