Skip to content

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