( matcher, combinator, base )
| 2245 | } |
| 2246 | |
| 2247 | function addCombinator( matcher, combinator, base ) { |
| 2248 | var dir = combinator.dir, |
| 2249 | skip = combinator.next, |
| 2250 | key = skip || dir, |
| 2251 | checkNonElements = base && key === "parentNode", |
| 2252 | doneName = done++; |
| 2253 | |
| 2254 | return combinator.first ? |
| 2255 | // Check against closest ancestor/preceding element |
| 2256 | function( elem, context, xml ) { |
| 2257 | while ( (elem = elem[ dir ]) ) { |
| 2258 | if ( elem.nodeType === 1 || checkNonElements ) { |
| 2259 | return matcher( elem, context, xml ); |
| 2260 | } |
| 2261 | } |
| 2262 | return false; |
| 2263 | } : |
| 2264 | |
| 2265 | // Check against all ancestor/preceding elements |
| 2266 | function( elem, context, xml ) { |
| 2267 | var oldCache, uniqueCache, outerCache, |
| 2268 | newCache = [ dirruns, doneName ]; |
| 2269 | |
| 2270 | // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching |
| 2271 | if ( xml ) { |
| 2272 | while ( (elem = elem[ dir ]) ) { |
| 2273 | if ( elem.nodeType === 1 || checkNonElements ) { |
| 2274 | if ( matcher( elem, context, xml ) ) { |
| 2275 | return true; |
| 2276 | } |
| 2277 | } |
| 2278 | } |
| 2279 | } else { |
| 2280 | while ( (elem = elem[ dir ]) ) { |
| 2281 | if ( elem.nodeType === 1 || checkNonElements ) { |
| 2282 | outerCache = elem[ expando ] || (elem[ expando ] = {}); |
| 2283 | |
| 2284 | // Support: IE <9 only |
| 2285 | // Defend against cloned attroperties (jQuery gh-1709) |
| 2286 | uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); |
| 2287 | |
| 2288 | if ( skip && skip === elem.nodeName.toLowerCase() ) { |
| 2289 | elem = elem[ dir ] || elem; |
| 2290 | } else if ( (oldCache = uniqueCache[ key ]) && |
| 2291 | oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { |
| 2292 | |
| 2293 | // Assign to newCache so results back-propagate to previous elements |
| 2294 | return (newCache[ 2 ] = oldCache[ 2 ]); |
| 2295 | } else { |
| 2296 | // Reuse newcache so results back-propagate to previous elements |
| 2297 | uniqueCache[ key ] = newCache; |
| 2298 | |
| 2299 | // A match means we're done; a fail means we have to keep checking |
| 2300 | if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { |
| 2301 | return true; |
| 2302 | } |
| 2303 | } |
| 2304 | } |
no outgoing calls
no test coverage detected