<p>I've seen news of <a href="http://github.com/jeresig/sizzle/tree/master" rel="noreferrer">John Resig's fast new selector engine named Sizzle</a> pop up in quite a few places, but I don't know what a selector engine is, nor have any of the articles given an explanation of what it is.  I know Resig is the creator of jQuery, and that Sizzle is something in Javascript, but beyond that I don't know what it is. So, what is a selector engine?</p>

<p>Thanks!</p>

[{'answer_id': 26411, 'author': 'Dave Ward', 'author_id': 60, 'author_profile': 'https://Stackoverflow.com/users/60', 'pm_score': 7, 'selected': True, 'text': "<p>A selector engine is used to query a page's DOM for particular elements, based on some sort of query (usually CSS syntax or similar).  </p>\n\n<p>For example, this jQuery:</p>\n\n<pre><code>$('div')\n</code></pre>\n\n<p>Would search for and return all of the &lt;div&gt; elements on the page.  It uses jQuery's selector engine to do that.</p>\n\n<p>Optimizing the selector engine is a big deal because almost every operation you perform with these frameworks is based on some sort of DOM query.</p>\n"}, {'answer_id': 26417, 'author': 'Darren Kopp', 'author_id': 77, 'author_profile': 'https://Stackoverflow.com/users/77', 'pm_score': 3, 'selected': False, 'text': "<p>Also, Sizzle is the engine John Resig is working on currently to replace jQuery's already fantastic selector engine.</p>\n"}, {'answer_id': 26418, 'author': 'dguaraglia', 'author_id': 2384, 'author_profile': 'https://Stackoverflow.com/users/2384', 'pm_score': 4, 'selected': False, 'text': "<p>A selector engine is a JavaScript library that lets you select elements in the DOM tree using some kind of string for identifying them (think regular expressions for DOM elements). Most selector engines use some variation of the CSS3 selectors syntax so, for example, you can write something like:</p>\n\n<pre><code>var paragraphs = selectorengine.select('p.firstParagraph')\n</code></pre>\n\n<p>to select all P elements in the document with class firstParagraph.</p>\n\n<p>Some selector engines also support a partial implementation of XPath, and even some custom syntaxes. For example, jQuery lets you write:</p>\n\n<pre><code>var checkedBoxes = jQuery('form#login input:checked')\n</code></pre>\n\n<p>To select all checked check boxes in the login form in the document.</p>\n"}, {'answer_id': 26419, 'author': 'FlySwat', 'author_id': 1965, 'author_profile': 'https://Stackoverflow.com/users/1965', 'pm_score': 3, 'selected': False, 'text': "<p>A selector engine is a way to traverse the DOM looking for a specific element.</p>\n\n<p>An example of a built in selector engine:</p>\n\n<pre><code>var foo = document.getElementById('foo');\n</code></pre>\n"}, {'answer_id': 537060, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>A selector engine is used to find elements in a document, in the same way as CSS stylesheets does. Currently only Safari has the built-in querySelectorAll function which does just that. With other browser you have to use external JavaScript implementations as <a href="http://llamalab.com/js/selector/" rel="nofollow noreferrer">LlamaLab Selector</a> or Sizzle instead. </p>\n'}]
['https://Stackoverflow.com/questions/26393', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1266/']