MCPcopy
hub / github.com/stemkoski/stemkoski.github.com / Sizzle

Function Sizzle

Three.js/js/jquery-1.9.1.js:3891–3999  ·  view source on GitHub ↗
( selector, context, results, seed )

Source from the content-addressed store, hash-verified

3889}
3890
3891function Sizzle( selector, context, results, seed ) {
3892 var match, elem, m, nodeType,
3893 // QSA vars
3894 i, groups, old, nid, newContext, newSelector;
3895
3896 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
3897 setDocument( context );
3898 }
3899
3900 context = context || document;
3901 results = results || [];
3902
3903 if ( !selector || typeof selector !== "string" ) {
3904 return results;
3905 }
3906
3907 if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
3908 return [];
3909 }
3910
3911 if ( !documentIsXML && !seed ) {
3912
3913 // Shortcuts
3914 if ( (match = rquickExpr.exec( selector )) ) {
3915 // Speed-up: Sizzle("#ID")
3916 if ( (m = match[1]) ) {
3917 if ( nodeType === 9 ) {
3918 elem = context.getElementById( m );
3919 // Check parentNode to catch when Blackberry 4.6 returns
3920 // nodes that are no longer in the document #6963
3921 if ( elem && elem.parentNode ) {
3922 // Handle the case where IE, Opera, and Webkit return items
3923 // by name instead of ID
3924 if ( elem.id === m ) {
3925 results.push( elem );
3926 return results;
3927 }
3928 } else {
3929 return results;
3930 }
3931 } else {
3932 // Context is not a document
3933 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
3934 contains( context, elem ) && elem.id === m ) {
3935 results.push( elem );
3936 return results;
3937 }
3938 }
3939
3940 // Speed-up: Sizzle("TAG")
3941 } else if ( match[2] ) {
3942 push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
3943 return results;
3944
3945 // Speed-up: Sizzle(".CLASS")
3946 } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
3947 push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
3948 return results;

Callers 2

jquery-1.9.1.jsFile · 0.85
multipleContextsFunction · 0.85

Calls 4

toSelectorFunction · 0.85
selectFunction · 0.85
containsFunction · 0.70
tokenizeFunction · 0.70

Tested by

no test coverage detected