github.com
Open in
urlscan Pro
140.82.121.4
Public Scan
Submitted URL: http://sizzlejs.com/
Effective URL: https://github.com/jquery/sizzle/wiki
Submission: On August 20 via api from US
Effective URL: https://github.com/jquery/sizzle/wiki
Submission: On August 20 via api from US
Form analysis
1 forms found in the DOMGET /jquery/sizzle/search
<form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="45547" data-scoped-search-url="/jquery/sizzle/search" data-owner-scoped-search-url="/orgs/jquery/search" data-unscoped-search-url="/search"
action="/jquery/sizzle/search" accept-charset="UTF-8" method="get">
<label class="form-control input-sm header-search-wrapper p-0 js-chromeless-input-container header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center">
<input type="text" class="form-control input-sm header-search-input jump-to-field js-jump-to-field js-site-search-focus js-site-search-field is-clearable" data-hotkey="s,/" name="q" data-test-selector="nav-search-input" placeholder="Search"
data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-autocomplete="list" aria-controls="jump-to-results" aria-label="Search"
data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" spellcheck="false" autocomplete="off">
<input type="hidden" data-csrf="true" class="js-data-jump-to-suggestions-path-csrf" value="M80K1Jr0z9Bnn9vYayC7sBk6WLiLS2lCAB4G5phD1vKkMZWgL3DDtB6REkQjvIRbUFaa+6uUU7u328R5jFOsqQ==">
<input type="hidden" class="js-site-search-type-field" name="type">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" class="mr-1 header-search-key-slash">
<path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path>
<path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path>
</svg>
<div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container">
<ul class="d-none js-jump-to-suggestions-template-container">
<li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-suggestion" role="option">
<a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href="" data-item-type="suggestion">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none">
<svg height="16" width="16" class="octicon octicon-repo flex-shrink-0 js-jump-to-octicon-repo d-none" title="Repository" aria-label="Repository" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></path></svg>
<svg height="16" width="16" class="octicon octicon-project flex-shrink-0 js-jump-to-octicon-project d-none" title="Project" aria-label="Project" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 3z"></path></svg>
<svg height="16" width="16" class="octicon octicon-search flex-shrink-0 js-jump-to-octicon-search d-none" title="Search" aria-label="Search" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></path></svg>
</div>
<img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28">
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target">
</div>
<div class="border rounded-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary ml-1 f6 d-none js-jump-to-badge-search">
<span class="js-jump-to-badge-search-text-default d-none" aria-label="in this repository">
In this repository
</span>
<span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub">
All GitHub
</span>
<span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>
</div>
<div aria-hidden="true" class="border rounded-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump">
Jump to
<span class="d-inline-block ml-1 v-align-middle">↵</span>
</div>
</a>
</li>
</ul>
<ul class="d-none js-jump-to-no-results-template-container">
<li class="d-flex flex-justify-center flex-items-center f5 d-none js-jump-to-suggestion p-2">
<span class="color-text-secondary">No suggested jump to results</span>
</li>
</ul>
<ul id="jump-to-results" role="listbox" class="p-0 m-0 js-navigation-container jump-to-suggestions-results-container js-jump-to-suggestions-results-container">
<li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-scoped-search d-none" role="option">
<a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href="" data-item-type="scoped_search">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none">
<svg height="16" width="16" class="octicon octicon-repo flex-shrink-0 js-jump-to-octicon-repo d-none" title="Repository" aria-label="Repository" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></path></svg>
<svg height="16" width="16" class="octicon octicon-project flex-shrink-0 js-jump-to-octicon-project d-none" title="Project" aria-label="Project" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 3z"></path></svg>
<svg height="16" width="16" class="octicon octicon-search flex-shrink-0 js-jump-to-octicon-search d-none" title="Search" aria-label="Search" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></path></svg>
</div>
<img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28">
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target">
</div>
<div class="border rounded-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary ml-1 f6 d-none js-jump-to-badge-search">
<span class="js-jump-to-badge-search-text-default d-none" aria-label="in this repository">
In this repository
</span>
<span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub">
All GitHub
</span>
<span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>
</div>
<div aria-hidden="true" class="border rounded-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump">
Jump to
<span class="d-inline-block ml-1 v-align-middle">↵</span>
</div>
</a>
</li>
<li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-owner-scoped-search d-none" role="option">
<a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href="" data-item-type="owner_scoped_search">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none">
<svg height="16" width="16" class="octicon octicon-repo flex-shrink-0 js-jump-to-octicon-repo d-none" title="Repository" aria-label="Repository" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></path></svg>
<svg height="16" width="16" class="octicon octicon-project flex-shrink-0 js-jump-to-octicon-project d-none" title="Project" aria-label="Project" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 3z"></path></svg>
<svg height="16" width="16" class="octicon octicon-search flex-shrink-0 js-jump-to-octicon-search d-none" title="Search" aria-label="Search" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></path></svg>
</div>
<img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28">
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target">
</div>
<div class="border rounded-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary ml-1 f6 d-none js-jump-to-badge-search">
<span class="js-jump-to-badge-search-text-default d-none" aria-label="in this organization">
In this organization
</span>
<span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub">
All GitHub
</span>
<span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>
</div>
<div aria-hidden="true" class="border rounded-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump">
Jump to
<span class="d-inline-block ml-1 v-align-middle">↵</span>
</div>
</a>
</li>
<li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-global-search d-none" role="option">
<a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href="" data-item-type="global_search">
<div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none">
<svg height="16" width="16" class="octicon octicon-repo flex-shrink-0 js-jump-to-octicon-repo d-none" title="Repository" aria-label="Repository" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></path></svg>
<svg height="16" width="16" class="octicon octicon-project flex-shrink-0 js-jump-to-octicon-project d-none" title="Project" aria-label="Project" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 3z"></path></svg>
<svg height="16" width="16" class="octicon octicon-search flex-shrink-0 js-jump-to-octicon-search d-none" title="Search" aria-label="Search" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></path></svg>
</div>
<img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28">
<div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target">
</div>
<div class="border rounded-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary ml-1 f6 d-none js-jump-to-badge-search">
<span class="js-jump-to-badge-search-text-default d-none" aria-label="in this repository">
In this repository
</span>
<span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub">
All GitHub
</span>
<span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>
</div>
<div aria-hidden="true" class="border rounded-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump">
Jump to
<span class="d-inline-block ml-1 v-align-middle">↵</span>
</div>
</a>
</li>
</ul>
</div>
</label>
</form>
Text Content
Skip to content Sign up * Why GitHub? Features → * Mobile → * Actions → * Codespaces → * Packages → * Security → * Code review → * Issues → * Integrations → * GitHub Sponsors → * Customer stories→ * Team * Enterprise * Explore * Explore GitHub → LEARN AND CONTRIBUTE * Topics → * Collections → * Trending → * Learning Lab → * Open source guides → CONNECT WITH OTHERS * The ReadME Project → * Events → * Community forum → * GitHub Education → * GitHub Stars program → * Marketplace * Pricing Plans → * Compare plans → * Contact Sales → * Education → * In this repository All GitHub ↵ Jump to ↵ * No suggested jump to results * In this repository All GitHub ↵ Jump to ↵ * In this organization All GitHub ↵ Jump to ↵ * In this repository All GitHub ↵ Jump to ↵ Sign in Sign up {{ message }} JQUERY / SIZZLE * Notifications * Star 6.1k * Fork 968 * Code * Issues 14 * Pull requests 2 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights HOME Jump to bottom Michał Gołębiowski-Owczarek edited this page on Apr 23, 2019 · 22 revisions Project Home Page | Source Repository | Google Group Discussion -------------------------------------------------------------------------------- BROWSER SUPPORT Note: Browser support may differ between standalone Sizzle and libraries that include Sizzle. Please report issues on Sizzle's issue tracker, rather than the trackers for disparate libraries. DESKTOP * Chrome 16+ * Edge 12+ * Firefox 3.6+ * Internet Explorer 7+1 * Opera 11.6+ * Safari 4.0+ 1Workarounds for Internet Explorer 6 are still in the code but the browser is no longer actively tested. MOBILE * Android 2.3+ * iOS 5.1+ To report a bug in any of these browsers, please add an issue with a test case from jsfiddle or jsbin. SELECTORS CSS3 Sizzle supports virtually all CSS 3 Selectors, including escaped selectors (.foo\+bar), Unicode selectors, and results returned in document order. The only exceptions are those that would require additional DOM event listeners to keep track of the state of elements. As such, the following pseudo-selectors are not supported: * :hover * :active * :visited, :link Note: These CSS3 pseudo-selectors were unsupported prior to version 1.9: * :target * :root * :nth-last-child * :nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type * :lang() OTHER SELECTORS AND CONVENTIONS CHANGES * Full selector lists in :not(); e.g. :not(a.b), :not(div > p), :not(div, p) * Nested pseudo-selectors; e.g. :not(:has(div:first-child)) ADDITIONS * [NAME!=VALUE]: Elements whose NAME attribute doesn't match the specified value. Equivalent to :not([NAME=VALUE]). * :contains(TEXT): Elements with textContent containing the word 'TEXT'. Case-sensitive. * :header: Header elements (h1, h2, h3, h4, h5, h6). * :parent: Elements with at least one child node (either text or an element). * :selected: (option) elements that are currently selected FORM SELECTOR ADDITIONS Note: In this context, input, button, select, and textarea are all considered to be input elements. * :input: Input elements * :button: Input elements that are buttons or have type "button" * :checkbox, :file, :image, :password, :radio, :reset, :submit, :text: Input elements with the specified type POSITIONAL SELECTOR ADDITIONS In this context, "positional" refers to an element's placement in the collection after a selection, based on document order. For example, div:first would return an array containing the first div on the page, while div:first em would target the first div on the page and select all em elements within. Note: Positional indexes begin at zero. * :first/:last: The first/last matching element * :even/:odd: Even/odd-numbered elements * :eq/:nth: The nth element; e.g. :eq(5) finds the 6th element * :lt/:gt: Elements at positions above/below the specified position -------------------------------------------------------------------------------- API The Sizzle API consists of 3 parts: * The Public API, which users interact with. * The Extension API, for modifications to the selector engine. * The Internal API, used internally by Sizzle. PUBLIC API SIZZLE( STRING SELECTOR[, DOMNODE CONTEXT[, ARRAY RESULTS]] ) The main function for finding elements. Uses querySelectorAll if available. returns (Array): All elements matching the selector Parameters selector: A CSS selector context: An element, document, or document fragment to use as the context for finding elements. Defaults to document. Note: Prior to version 2.1, document fragments were not valid here. results: An array or an array-like object, to which Sizzle will append results. For example, jQuery passes a jQuery collection. An "array-like object" is an object with a nonnegative numeric length property and a push method. SIZZLE.MATCHESSELECTOR( DOMELEMENT ELEMENT, STRING SELECTOR ) Uses native matchesSelector if available returns(Boolean): Whether the given element matches the selector Parameters element: A DOMElement against which Sizzle will test the selector selector: A CSS selector SIZZLE.MATCHES( STRING SELECTOR, ARRAY<DOMELEMENT> ELEMENTS ) returns(Array): Elements in the array that match the given selector Parameters selector: A CSS selector elements: An array of DOMElements to filter against the specified selector EXTENSION API SIZZLE.SELECTORS.MATCH.NAME = REGEXP This contains the regular expressions used to parse a selector into different parts, to be used for finding and filtering. The name of each of the regular expressions should correspond to the names specified in the Sizzle.selectors.find and Sizzle.selectors.filter objects. FINDING In order to add a new find function: * A regular expression must be added to the match object. * A function to find must be defined. * "|" + NAME must be appended to the Sizzle.selectors.order regex. SIZZLE.SELECTORS.FIND.NAME = FUNCTION( MATCH, CONTEXT, ISXML ) {} A method for finding some elements on a page. The specified function will be called no more than once per selector. * match is the array of results returned from matching the specified regex against the selector. * context is the DOMElement or DOMDocument from which selection will occur. * isXML is a boolean value indicating whether the function is currently operating within an XML document. FILTERING In order to add a new filtering statement: * A regular expression must be added to the match object. * A function must be added to the filter object. * A function may optionally be added to the preFilter object. SIZZLE.SELECTORS.PREFILTER.NAME = FUNCTION( MATCH ) {} An optional pre-filter function which allows filtering of the matched array against the corresponding regular expression, which will return a new matched array. This matched array will eventually be passed and flattened as arguments against the corresponding filter function. This is intended to clean up some of the repetitive processing that occurs in a filter function. SIZZLE.SELECTORS.FILTER.NAME: FUNCTION( ELEMENT, MATCH[1][, MATCH[2], MATCH[3], ...] ) {} Note: match[0] will be deleted prior to being passed to a filter, and must not be used. The arguments for a filter method are the element and the captures from the regex corresponding to this filter (indicated above by what is in the match, starting at index 1). The return result must be boolean: true if the element matches the selector, false if not. ATTRIBUTES SIZZLE.SELECTORS.ATTRHANDLE.LOWERCASE_NAME = FUNCTION( ELEM, CASEPRESERVEDNAME, ISXML ) {} Handle an attribute which requires specialized processing (such as href, which has cross-browser issues). The return result must be the actual string value of that attribute. PSEUDO-SELECTORS (PSEUDOS) SIZZLE.SELECTORS.PSEUDOS.NAME = FUNCTION( ELEM ) {} The most common extension to a selector engine: adding a new pseudo. The return result from this function must be boolean: true if the element matches the selector, false if not. For example, this defines a simple :fixed pseudo: var $test = jQuery( document ); Sizzle.selectors.pseudos.fixed = function( elem ) { $test[ 0 ] = elem; return $test.css( "position" ) === "fixed"; }; SIZZLE.SELECTORS.CREATEPSEUDO(FUNCTION) createPseudo is only required if the custom pseudo-selector accepts an argument. Note: In jQuery 1.8 and earlier, the API for creating custom pseudos with arguments was broken. In jQuery 1.8.1+, the API is backwards-compatible. Regardless, the use of createPseudo is greatly encouraged. Now that the parser compiles a single function containing other functions, custom pseudo-selectors with arguments are much cleaner. For example, within Sizzle, the implementation of the :not( <sub-selector> ) pseudo is very similar to: Sizzle.selectors.pseudos.not = Sizzle.selectors.createPseudo(function( subSelector ) { var matcher = Sizzle.compile( subSelector ); return function( elem ) { return !matcher( elem ); }; }); BACKWARDS-COMPATIBLE PLUGINS FOR PSEUDOS WITH ARGUMENTS In order to write a custom selector with arguments that can take advantage of the new API, yet still support all versions of Sizzle, check for the createPseudo method. The following example uses jQuery syntax. Live example // An implementation of a case-insensitive contains pseudo // made for all versions of jQuery (function( $ ) { function icontains( elem, text ) { return ( elem.textContent || elem.innerText || $( elem ).text() || "" ).toLowerCase().indexOf( (text || "").toLowerCase() ) > -1; } $.expr.pseudos.icontains = $.expr.createPseudo ? $.expr.createPseudo(function( text ) { return function( elem ) { return icontains( elem, text ); }; }) : function( elem, i, match ) { return icontains( elem, match[3] ); }; })( jQuery ); SIZZLE.SELECTORS.SETFILTERS.LOWERCASE_NAME = FUNCTION( ELEMENTS, ARGUMENT, NOT ) {} These filters are run after a previous part of a selector has already returned results. setFilters are found from matching Sizzle.selectors.match.POS. When applicable, argument is expected to be an integer. The not argument is a boolean indicating whether the result should be inverted (as in div:not(:first)). For example, the code for the :first setFilter is similar to: var first = function( elements, argument, not ) { // No argument for first return not ? elements.slice( 1 ) : [ elements[0] ]; }; Sizzle.selectors.setFilters.first = first; It is easy to extend Sizzle -- even Sizzle's POS selectors. For example, to rename :first as :uno: Sizzle.selectors.match.POS = new RegExp( oldPOS.source.replace("first", "uno"), "gi" ); Sizzle.selectors.setFilters.uno = Sizzle.selectors.setFilters.first; delete Sizzle.selectors.setFilters.first; Sizzle("div:uno"); // ==> [ <div> ] INTERNAL API Note: Functionality should be accessed via the Public and Extension APIs. While the Internal API is intended specifically for internal use, it has been exposed for edge cases. SIZZLE.SELECTORS.CACHELENGTH Sizzle internally caches compiled selector functions and tokenization objects. The length of these caches defaults to 50, but can be set to any positive integer by assigning to this property. SIZZLE.COMPILE( SELECTOR ) This method compiles a selector function and caches it for later use. For example, calling Sizzle.compile(".myWidget:myPseudo") during initialization of a plugin will speed up the first selection of matching elements. returns(Function): The compiled function to be used when filtering the set of possibly matching elements Parameters selector: A CSS selector -------------------------------------------------------------------------------- THANKS Special thanks goes out to the following. Without their contributions to the open source community, Sizzle would not be what it is today. * Diego Perini and NWMatcher. * The creators of the Slick selector engine used in mootools. * Samuel Lebeau for writing bouncer, a small bottom-up element matcher. PAGES 2 * Home * Browser Support * Desktop * Mobile * Selectors * CSS3 * Other selectors and conventions * Changes * Additions * Form Selector Additions * Positional Selector Additions * API * Public API * Sizzle( String selector[, DOMNode context[, Array results]] ) * Sizzle.matchesSelector( DOMElement element, String selector ) * Sizzle.matches( String selector, Array<DOMElement> elements ) * Extension API * Sizzle.selectors.match.NAME = RegExp * Finding * Sizzle.selectors.find.NAME = function( match, context, isXML ) {} * Filtering * Sizzle.selectors.preFilter.NAME = function( match ) {} * Sizzle.selectors.filter.NAME: function( element, match[1][, match[2], match[3], ...] ) {} * Attributes * Sizzle.selectors.attrHandle.LOWERCASE_NAME = function( elem, casePreservedName, isXML ) {} * Pseudo-selectors (pseudos) * Sizzle.selectors.pseudos.NAME = function( elem ) {} * Sizzle.selectors.createPseudo(function) * Backwards-compatible plugins for pseudos with arguments * Sizzle.selectors.setFilters.LOWERCASE_NAME = function( elements, argument, not ) {} * Internal API * Sizzle.selectors.cacheLength * Sizzle.compile( selector ) * Thanks * Roadmap CLONE THIS WIKI LOCALLY * © 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can’t perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.