MCPcopy Index your code
hub / github.com/frank-lam/fullstack-tutorial / Sizzle

Function Sizzle

notes/docsify/unpkg/gotop/jquery-2.1.0.js:733–840  ·  view source on GitHub ↗
( selector, context, results, seed )

Source from the content-addressed store, hash-verified

731}
732
733function Sizzle( selector, context, results, seed ) {
734 var match, elem, m, nodeType,
735 // QSA vars
736 i, groups, old, nid, newContext, newSelector;
737
738 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
739 setDocument( context );
740 }
741
742 context = context || document;
743 results = results || [];
744
745 if ( !selector || typeof selector !== "string" ) {
746 return results;
747 }
748
749 if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
750 return [];
751 }
752
753 if ( documentIsHTML && !seed ) {
754
755 // Shortcuts
756 if ( (match = rquickExpr.exec( selector )) ) {
757 // Speed-up: Sizzle("#ID")
758 if ( (m = match[1]) ) {
759 if ( nodeType === 9 ) {
760 elem = context.getElementById( m );
761 // Check parentNode to catch when Blackberry 4.6 returns
762 // nodes that are no longer in the document (jQuery #6963)
763 if ( elem && elem.parentNode ) {
764 // Handle the case where IE, Opera, and Webkit return items
765 // by name instead of ID
766 if ( elem.id === m ) {
767 results.push( elem );
768 return results;
769 }
770 } else {
771 return results;
772 }
773 } else {
774 // Context is not a document
775 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
776 contains( context, elem ) && elem.id === m ) {
777 results.push( elem );
778 return results;
779 }
780 }
781
782 // Speed-up: Sizzle("TAG")
783 } else if ( match[2] ) {
784 push.apply( results, context.getElementsByTagName( selector ) );
785 return results;
786
787 // Speed-up: Sizzle(".CLASS")
788 } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
789 push.apply( results, context.getElementsByClassName( m ) );
790 return results;

Callers 2

jquery-2.1.0.jsFile · 0.85
multipleContextsFunction · 0.85

Calls 4

tokenizeFunction · 0.85
toSelectorFunction · 0.85
testContextFunction · 0.85
selectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…