Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slick vs. Sizzle -- Pros and Cons of CSS selector engines

When would I want to use Slick and when would I want to use Sizzle? What are the pros and cons of each as a standalone CSS selector engine? How easily can Slick be used with JQuery? Can Sizzle be used with Mootools?

like image 400
GoalBased Avatar asked Jul 16 '10 19:07

GoalBased


People also ask

Which is the best selector in css?

Class selector is the most useful common selector used by the developers. You can define the class selector using period (.) followed by the class name. It gives styling to all elements with a specified class attribute.

Which selector is faster in css?

popupbutton is the fastest.

Which is faster CSS selector or XPath?

Advantages of Using CSS Selector It's faster than XPath. It's much easier to learn and implement. You have a high chance of finding your elements. It's compatible with most browsers to date.

Which is better XPath css Why?

In terms of performance, css is better and faster, while xpath is on a slower side. An xpath can be of two types – absolute which starts from the root node and relative does not require to be started from the root. To traverse to the nth element, we have to mention [n] in the xpath, where n is the index number.


2 Answers

http://davidwalsh.name/mootools-sizzle - using mootools with sizzle.

valerio posted about why mootools in particular was never going to use a 3-rd party project like sizzle - lookie here http://ajaxian.com/archives/mootools-and-sizzle

since that post, the need to scale the mootools selector engine must have resulted in the advent of slick (which is a standalone engine but one that the mootools team develop so its easily maintainable / patchable)

you can easily checkout slick and port it into whatever framework as well. here's a gist on using slick in mootools 1.2.x - http://gist.github.com/361474

interesting posts on use are around, http://davidwalsh.name/elements-shorthand-slick for example but it's all early adopters stuff so before 1.3 is out proper, i don't expect it getting too much attention.

as for performance, its nearly identical from some beta tests i saw a while back with sizzle getting ahead slightly on things like document.body. anyway, post your findings, would be interesting.

like image 117
Dimitar Christoff Avatar answered Sep 27 '22 22:09

Dimitar Christoff


I realize that this is an older post, but I recently came across it while searching for a way to use Sizzle instead of Slick with MooTools, specifically as an effort to improve performance. Ultimately I couldn't find anything existing, but the Gist referenced above lead me to writing a library that allows swapping out Slick for Sizzle without altering the MooTools API. I am sharing it here as a point of reference for anyone else who may come across this post with similar intent. The library can be found on GitHub at https://github.com/mzabriskie/sickle

like image 22
mzabriskie Avatar answered Sep 27 '22 20:09

mzabriskie