MCPcopy Index your code
hub / github.com/sql-js/sql.js / Sizzle

Function Sizzle

documentation/javascript/application.js:4765–4823  ·  view source on GitHub ↗
( selector, context, results, seed )

Source from the content-addressed store, hash-verified

4763}
4764
4765function Sizzle( selector, context, results, seed ) {
4766 results = results || [];
4767 context = context || document;
4768 var match, elem, xml, m,
4769 nodeType = context.nodeType;
4770
4771 if ( nodeType !== 1 && nodeType !== 9 ) {
4772 return [];
4773 }
4774
4775 if ( !selector || typeof selector !== "string" ) {
4776 return results;
4777 }
4778
4779 xml = isXML( context );
4780
4781 if ( !xml && !seed ) {
4782 if ( (match = rquickExpr.exec( selector )) ) {
4783 // Speed-up: Sizzle("#ID")
4784 if ( (m = match[1]) ) {
4785 if ( nodeType === 9 ) {
4786 elem = context.getElementById( m );
4787 // Check parentNode to catch when Blackberry 4.6 returns
4788 // nodes that are no longer in the document #6963
4789 if ( elem && elem.parentNode ) {
4790 // Handle the case where IE, Opera, and Webkit return items
4791 // by name instead of ID
4792 if ( elem.id === m ) {
4793 results.push( elem );
4794 return results;
4795 }
4796 } else {
4797 return results;
4798 }
4799 } else {
4800 // Context is not a document
4801 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
4802 contains( context, elem ) && elem.id === m ) {
4803 results.push( elem );
4804 return results;
4805 }
4806 }
4807
4808 // Speed-up: Sizzle("TAG")
4809 } else if ( match[2] ) {
4810 push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
4811 return results;
4812
4813 // Speed-up: Sizzle(".CLASS")
4814 } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {
4815 push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
4816 return results;
4817 }
4818 }
4819 }
4820
4821 // All others
4822 return select( selector, context, results, seed, xml );

Callers 3

application.jsFile · 0.85
multipleContextsFunction · 0.85
handlePOSFunction · 0.85

Calls 2

containsFunction · 0.85
selectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…