( selector, context, results, seed )
| 731 | } |
| 732 | |
| 733 | function 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; |
no test coverage detected
searching dependent graphs…