MCPcopy Index your code
hub / github.com/JsAaron/jQuery / Sizzle

Function Sizzle

2.1.1/test/jquery-2.1.1.js:736–843  ·  view source on GitHub ↗
( selector, context, results, seed )

Source from the content-addressed store, hash-verified

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

Callers 2

jquery-2.1.1.jsFile · 0.70
multipleContextsFunction · 0.70

Calls 4

toSelectorFunction · 0.70
testContextFunction · 0.70
tokenizeFunction · 0.50
selectFunction · 0.50

Tested by

no test coverage detected