MCPcopy
hub / github.com/jquery-backstretch/jquery-backstretch / Sizzle

Function Sizzle

libs/jquery/jquery.js:3880–3938  ·  view source on GitHub ↗
( selector, context, results, seed )

Source from the content-addressed store, hash-verified

3878}
3879
3880function Sizzle( selector, context, results, seed ) {
3881 results = results || [];
3882 context = context || document;
3883 var match, elem, xml, m,
3884 nodeType = context.nodeType;
3885
3886 if ( !selector || typeof selector !== "string" ) {
3887 return results;
3888 }
3889
3890 if ( nodeType !== 1 && nodeType !== 9 ) {
3891 return [];
3892 }
3893
3894 xml = isXML( context );
3895
3896 if ( !xml && !seed ) {
3897 if ( (match = rquickExpr.exec( selector )) ) {
3898 // Speed-up: Sizzle("#ID")
3899 if ( (m = match[1]) ) {
3900 if ( nodeType === 9 ) {
3901 elem = context.getElementById( m );
3902 // Check parentNode to catch when Blackberry 4.6 returns
3903 // nodes that are no longer in the document #6963
3904 if ( elem && elem.parentNode ) {
3905 // Handle the case where IE, Opera, and Webkit return items
3906 // by name instead of ID
3907 if ( elem.id === m ) {
3908 results.push( elem );
3909 return results;
3910 }
3911 } else {
3912 return results;
3913 }
3914 } else {
3915 // Context is not a document
3916 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
3917 contains( context, elem ) && elem.id === m ) {
3918 results.push( elem );
3919 return results;
3920 }
3921 }
3922
3923 // Speed-up: Sizzle("TAG")
3924 } else if ( match[2] ) {
3925 push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
3926 return results;
3927
3928 // Speed-up: Sizzle(".CLASS")
3929 } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {
3930 push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
3931 return results;
3932 }
3933 }
3934 }
3935
3936 // All others
3937 return select( selector.replace( rtrim, "$1" ), context, results, seed, xml );

Callers 2

jquery.jsFile · 0.85
multipleContextsFunction · 0.85

Calls 1

selectFunction · 0.85

Tested by

no test coverage detected