Sizzle Selector Engine

  Home  Client Side Scripting  Sizzle Selector Engine

“Sizzle Selector Engine frequently Asked Questions by expert members with experience in Sizzle Selector Engine. These questions and answers will help you strengthen your technical skills, prepare for the new job test and quickly revise the concepts”

5 Sizzle Selector Engine Questions And Answers

1⟩ Explain Form Selector Additions?

:input: Finds all input elements (includes textareas, selects, and buttons).

:text, :checkbox, :file, :password, :submit, :image, :reset, :button: Finds the input element with the specified input type (:button also finds button elements).


2⟩ Explain Sizzle Selectors?

Sizzle supports virtually all CSS 3 Selectors - this even includes some parts that are infrequently implemented such as escaped selectors (".foo+bar"), Unicode selectors, and results returned in document order. There are a few exceptions to CSS3 selector support. These exceptions are only limited to selectors that would require events added to the DOM to keep track of the state of elements. For instance, the following pseudo-selectors are not supported:




:link (this is the opposite of :visited and also requires an event)

Note: Some CSS3 selectors were not supported until version 1.9. These were added in 1.9:




:nth-of-type / :nth-last-of-type / :first-of-type / :last-of-type / :only-of-type



3⟩ Explain Positional Selector Additions?

The word positional here refers to an element's placement in the set after a selection, based on document order. For instance, div:first would return an array containing the first div on the page and div:first em would initially get the first div on the page, then all of the em's within that div. This works by first doing a selection for divs, retrieving the first one from that set, then using that div as the context for finding all em's. Note that all positional selectors are zero-indexed (corresponding to array positions).

:first/:last: Finds the first or last matching element on the page.

:even/:odd: Finds every other element on the page (counting begins at 0, so :even would match the first element).

:eq/:nth: Finds the nth element on the page (e.g. :eq(5) finds the 6th element on the page).

:lt/:gt: Finds all elements at positions less than or greater than the specified positions


4⟩ Explain Sizzle Selector Engine Features?

Completely standalone (no library dependencies)

Competitive performance for most frequently used selectors

Only 4KB minified and gzipped

Highly extensible with easy-to-use API

Designed for optimal performance with event delegation

Clear IP assignment (all code held by the Dojo Foundation, contributors sign CLAs)