Sizzle Selector Engine Interview Preparation Guide
Download PDF

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 :: What is a Sizzle CSS Selector Engine?

There's a "Sizzle CSS Selector Engine" in my WordPress installation. What is it for? Can I safely delete it to reduce the size of my file?

2 :: 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)

3 :: 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:

:hover
:active
:visited
: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:

:target
:root
:nth-last-child
:nth-of-type / :nth-last-of-type / :first-of-type / :last-of-type / :only-of-type
:lang()

4 :: 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

5 :: 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).