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

Function handlePOS

documentation/javascript/application.js:5769–5850  ·  view source on GitHub ↗
( groups, context, results, seed )

Source from the content-addressed store, hash-verified

5767}
5768
5769function handlePOS( groups, context, results, seed ) {
5770 var group, part, j, groupLen, token, selector,
5771 anchor, elements, match, matched,
5772 lastIndex, currentContexts, not,
5773 i = 0,
5774 len = groups.length,
5775 rpos = matchExpr["POS"],
5776 // This is generated here in case matchExpr["POS"] is extended
5777 rposgroups = new RegExp( "^" + rpos.source + "(?!" + whitespace + ")", "i" ),
5778 // This is for making sure non-participating
5779 // matching groups are represented cross-browser (IE6-8)
5780 setUndefined = function() {
5781 var i = 1,
5782 len = arguments.length - 2;
5783 for ( ; i < len; i++ ) {
5784 if ( arguments[i] === undefined ) {
5785 match[i] = undefined;
5786 }
5787 }
5788 };
5789
5790 for ( ; i < len; i++ ) {
5791 group = groups[i];
5792 part = "";
5793 elements = seed;
5794 for ( j = 0, groupLen = group.length; j < groupLen; j++ ) {
5795 token = group[j];
5796 selector = token.string;
5797 if ( token.part === "PSEUDO" ) {
5798 // Reset regex index to 0
5799 rpos.exec("");
5800 anchor = 0;
5801 while ( (match = rpos.exec( selector )) ) {
5802 matched = true;
5803 lastIndex = rpos.lastIndex = match.index + match[0].length;
5804 if ( lastIndex > anchor ) {
5805 part += selector.slice( anchor, match.index );
5806 anchor = lastIndex;
5807 currentContexts = [ context ];
5808
5809 if ( rcombinators.test(part) ) {
5810 if ( elements ) {
5811 currentContexts = elements;
5812 }
5813 elements = seed;
5814 }
5815
5816 if ( (not = rendsWithNot.test( part )) ) {
5817 part = part.slice( 0, -5 ).replace( rcombinators, "$&*" );
5818 anchor++;
5819 }
5820
5821 if ( match.length > 1 ) {
5822 match[0].replace( rposgroups, setUndefined );
5823 }
5824 elements = handlePOSGroup( part, match[1], match[2], currentContexts, elements, not );
5825 }
5826 part = "";

Callers 1

selectFunction · 0.85

Calls 3

handlePOSGroupFunction · 0.85
multipleContextsFunction · 0.85
SizzleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…