kazinix
kazinix

Reputation: 30103

JavaScript - DOM Selector Engine

Is there any selector engine for DOM elements like jQuery which offers no other extended methods like .bind, .css etc? What I mean is, a selector which just return found elements, nothing more. I tried to modify the jQuery, removed methods to get only the function that returns elements, but I got errors.

Thanks in advance!

Upvotes: 3

Views: 710

Answers (3)

niutech
niutech

Reputation: 29932

Yes, there are many tiny JavaScript selector engines, like:

I'd recommend Quicksand, because it seems to be the fastest one (see this or this test).

Upvotes: 1

shabunc
shabunc

Reputation: 24731

If you code is intended to work only in modern browsers and the set of possible selectors is relatively simple (A.classA B.classB or something) you can use document.querySelectorAll with a thin wrapper over it or even do not use any frameworks at all.

As for old browsers, well, you always can try to implement it yourself, if size is so crucial for you. You can choose a tiny set of simple CSS selectors and use only them.

But, as well ipr101, I guess it will be better to use production-ready solution like sizzle.

Upvotes: 1

ipr101
ipr101

Reputation: 24236

Have you looked at sizzle -

http://sizzlejs.com/

I believe it is the selector engine that jQuery uses.

Upvotes: 3

Related Questions