( selector, parseOnly )
| 658 | var tokenCache = createCache(); |
| 659 | |
| 660 | function tokenize( selector, parseOnly ) { |
| 661 | var matched, match, tokens, type, |
| 662 | soFar, groups, preFilters, |
| 663 | cached = tokenCache[ selector + " " ]; |
| 664 | |
| 665 | if ( cached ) { |
| 666 | return parseOnly ? 0 : cached.slice( 0 ); |
| 667 | } |
| 668 | |
| 669 | soFar = selector; |
| 670 | groups = []; |
| 671 | preFilters = jQuery.expr.preFilter; |
| 672 | |
| 673 | while ( soFar ) { |
| 674 | |
| 675 | // Comma and first run |
| 676 | if ( !matched || ( match = rcomma.exec( soFar ) ) ) { |
| 677 | if ( match ) { |
| 678 | |
| 679 | // Don't consume trailing commas as valid |
| 680 | soFar = soFar.slice( match[ 0 ].length ) || soFar; |
| 681 | } |
| 682 | groups.push( ( tokens = [] ) ); |
| 683 | } |
| 684 | |
| 685 | matched = false; |
| 686 | |
| 687 | // Combinators |
| 688 | if ( ( match = rleadingCombinator.exec( soFar ) ) ) { |
| 689 | matched = match.shift(); |
| 690 | tokens.push( { |
| 691 | value: matched, |
| 692 | |
| 693 | // Cast descendant combinators to space |
| 694 | type: match[ 0 ].replace( rtrimCSS, " " ) |
| 695 | } ); |
| 696 | soFar = soFar.slice( matched.length ); |
| 697 | } |
| 698 | |
| 699 | // Filters |
| 700 | for ( type in filterMatchExpr ) { |
| 701 | if ( ( match = jQuery.expr.match[ type ].exec( soFar ) ) && ( !preFilters[ type ] || |
| 702 | ( match = preFilters[ type ]( match ) ) ) ) { |
| 703 | matched = match.shift(); |
| 704 | tokens.push( { |
| 705 | value: matched, |
| 706 | type: type, |
| 707 | matches: match |
| 708 | } ); |
| 709 | soFar = soFar.slice( matched.length ); |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | if ( !matched ) { |
| 714 | break; |
| 715 | } |
| 716 | } |
| 717 |
no test coverage detected