@@ 3879-4024 (lines=146) @@ | ||
3876 | return 0; |
|
3877 | }); |
|
3878 | ||
3879 | var Sizzle = function( selector, context, results, seed ) { |
|
3880 | results = results || []; |
|
3881 | context = context || document; |
|
3882 | ||
3883 | var origContext = context; |
|
3884 | ||
3885 | if ( context.nodeType !== 1 && context.nodeType !== 9 ) { |
|
3886 | return []; |
|
3887 | } |
|
3888 | ||
3889 | if ( !selector || typeof selector !== "string" ) { |
|
3890 | return results; |
|
3891 | } |
|
3892 | ||
3893 | var m, set, checkSet, extra, ret, cur, pop, i, |
|
3894 | prune = true, |
|
3895 | contextXML = Sizzle.isXML( context ), |
|
3896 | parts = [], |
|
3897 | soFar = selector; |
|
3898 | ||
3899 | // Reset the position of the chunker regexp (start from head) |
|
3900 | do { |
|
3901 | chunker.exec( "" ); |
|
3902 | m = chunker.exec( soFar ); |
|
3903 | ||
3904 | if ( m ) { |
|
3905 | soFar = m[3]; |
|
3906 | ||
3907 | parts.push( m[1] ); |
|
3908 | ||
3909 | if ( m[2] ) { |
|
3910 | extra = m[3]; |
|
3911 | break; |
|
3912 | } |
|
3913 | } |
|
3914 | } while ( m ); |
|
3915 | ||
3916 | if ( parts.length > 1 && origPOS.exec( selector ) ) { |
|
3917 | ||
3918 | if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { |
|
3919 | set = posProcess( parts[0] + parts[1], context, seed ); |
|
3920 | ||
3921 | } else { |
|
3922 | set = Expr.relative[ parts[0] ] ? |
|
3923 | [ context ] : |
|
3924 | Sizzle( parts.shift(), context ); |
|
3925 | ||
3926 | while ( parts.length ) { |
|
3927 | selector = parts.shift(); |
|
3928 | ||
3929 | if ( Expr.relative[ selector ] ) { |
|
3930 | selector += parts.shift(); |
|
3931 | } |
|
3932 | ||
3933 | set = posProcess( selector, set, seed ); |
|
3934 | } |
|
3935 | } |
|
3936 | ||
3937 | } else { |
|
3938 | // Take a shortcut and set the context if the root selector is an ID |
|
3939 | // (but not if it'll be faster if the inner selector is an ID) |
|
3940 | if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && |
|
3941 | Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { |
|
3942 | ||
3943 | ret = Sizzle.find( parts.shift(), context, contextXML ); |
|
3944 | context = ret.expr ? |
|
3945 | Sizzle.filter( ret.expr, ret.set )[0] : |
|
3946 | ret.set[0]; |
|
3947 | } |
|
3948 | ||
3949 | if ( context ) { |
|
3950 | ret = seed ? |
|
3951 | { expr: parts.pop(), set: makeArray(seed) } : |
|
3952 | Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); |
|
3953 | ||
3954 | set = ret.expr ? |
|
3955 | Sizzle.filter( ret.expr, ret.set ) : |
|
3956 | ret.set; |
|
3957 | ||
3958 | if ( parts.length > 0 ) { |
|
3959 | checkSet = makeArray( set ); |
|
3960 | ||
3961 | } else { |
|
3962 | prune = false; |
|
3963 | } |
|
3964 | ||
3965 | while ( parts.length ) { |
|
3966 | cur = parts.pop(); |
|
3967 | pop = cur; |
|
3968 | ||
3969 | if ( !Expr.relative[ cur ] ) { |
|
3970 | cur = ""; |
|
3971 | } else { |
|
3972 | pop = parts.pop(); |
|
3973 | } |
|
3974 | ||
3975 | if ( pop == null ) { |
|
3976 | pop = context; |
|
3977 | } |
|
3978 | ||
3979 | Expr.relative[ cur ]( checkSet, pop, contextXML ); |
|
3980 | } |
|
3981 | ||
3982 | } else { |
|
3983 | checkSet = parts = []; |
|
3984 | } |
|
3985 | } |
|
3986 | ||
3987 | if ( !checkSet ) { |
|
3988 | checkSet = set; |
|
3989 | } |
|
3990 | ||
3991 | if ( !checkSet ) { |
|
3992 | Sizzle.error( cur || selector ); |
|
3993 | } |
|
3994 | ||
3995 | if ( toString.call(checkSet) === "[object Array]" ) { |
|
3996 | if ( !prune ) { |
|
3997 | results.push.apply( results, checkSet ); |
|
3998 | ||
3999 | } else if ( context && context.nodeType === 1 ) { |
|
4000 | for ( i = 0; checkSet[i] != null; i++ ) { |
|
4001 | if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { |
|
4002 | results.push( set[i] ); |
|
4003 | } |
|
4004 | } |
|
4005 | ||
4006 | } else { |
|
4007 | for ( i = 0; checkSet[i] != null; i++ ) { |
|
4008 | if ( checkSet[i] && checkSet[i].nodeType === 1 ) { |
|
4009 | results.push( set[i] ); |
|
4010 | } |
|
4011 | } |
|
4012 | } |
|
4013 | ||
4014 | } else { |
|
4015 | makeArray( checkSet, results ); |
|
4016 | } |
|
4017 | ||
4018 | if ( extra ) { |
|
4019 | Sizzle( extra, origContext, results, seed ); |
|
4020 | Sizzle.uniqueSort( results ); |
|
4021 | } |
|
4022 | ||
4023 | return results; |
|
4024 | }; |
|
4025 | ||
4026 | Sizzle.uniqueSort = function( results ) { |
|
4027 | if ( sortOrder ) { |
@@ 3283-3428 (lines=146) @@ | ||
3280 | return 0; |
|
3281 | }); |
|
3282 | ||
3283 | var Sizzle = function( selector, context, results, seed ) { |
|
3284 | results = results || []; |
|
3285 | context = context || document; |
|
3286 | ||
3287 | var origContext = context; |
|
3288 | ||
3289 | if ( context.nodeType !== 1 && context.nodeType !== 9 ) { |
|
3290 | return []; |
|
3291 | } |
|
3292 | ||
3293 | if ( !selector || typeof selector !== "string" ) { |
|
3294 | return results; |
|
3295 | } |
|
3296 | ||
3297 | var m, set, checkSet, extra, ret, cur, pop, i, |
|
3298 | prune = true, |
|
3299 | contextXML = Sizzle.isXML( context ), |
|
3300 | parts = [], |
|
3301 | soFar = selector; |
|
3302 | ||
3303 | // Reset the position of the chunker regexp (start from head) |
|
3304 | do { |
|
3305 | chunker.exec( "" ); |
|
3306 | m = chunker.exec( soFar ); |
|
3307 | ||
3308 | if ( m ) { |
|
3309 | soFar = m[3]; |
|
3310 | ||
3311 | parts.push( m[1] ); |
|
3312 | ||
3313 | if ( m[2] ) { |
|
3314 | extra = m[3]; |
|
3315 | break; |
|
3316 | } |
|
3317 | } |
|
3318 | } while ( m ); |
|
3319 | ||
3320 | if ( parts.length > 1 && origPOS.exec( selector ) ) { |
|
3321 | ||
3322 | if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { |
|
3323 | set = posProcess( parts[0] + parts[1], context ); |
|
3324 | ||
3325 | } else { |
|
3326 | set = Expr.relative[ parts[0] ] ? |
|
3327 | [ context ] : |
|
3328 | Sizzle( parts.shift(), context ); |
|
3329 | ||
3330 | while ( parts.length ) { |
|
3331 | selector = parts.shift(); |
|
3332 | ||
3333 | if ( Expr.relative[ selector ] ) { |
|
3334 | selector += parts.shift(); |
|
3335 | } |
|
3336 | ||
3337 | set = posProcess( selector, set ); |
|
3338 | } |
|
3339 | } |
|
3340 | ||
3341 | } else { |
|
3342 | // Take a shortcut and set the context if the root selector is an ID |
|
3343 | // (but not if it'll be faster if the inner selector is an ID) |
|
3344 | if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && |
|
3345 | Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { |
|
3346 | ||
3347 | ret = Sizzle.find( parts.shift(), context, contextXML ); |
|
3348 | context = ret.expr ? |
|
3349 | Sizzle.filter( ret.expr, ret.set )[0] : |
|
3350 | ret.set[0]; |
|
3351 | } |
|
3352 | ||
3353 | if ( context ) { |
|
3354 | ret = seed ? |
|
3355 | { expr: parts.pop(), set: makeArray(seed) } : |
|
3356 | Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); |
|
3357 | ||
3358 | set = ret.expr ? |
|
3359 | Sizzle.filter( ret.expr, ret.set ) : |
|
3360 | ret.set; |
|
3361 | ||
3362 | if ( parts.length > 0 ) { |
|
3363 | checkSet = makeArray( set ); |
|
3364 | ||
3365 | } else { |
|
3366 | prune = false; |
|
3367 | } |
|
3368 | ||
3369 | while ( parts.length ) { |
|
3370 | cur = parts.pop(); |
|
3371 | pop = cur; |
|
3372 | ||
3373 | if ( !Expr.relative[ cur ] ) { |
|
3374 | cur = ""; |
|
3375 | } else { |
|
3376 | pop = parts.pop(); |
|
3377 | } |
|
3378 | ||
3379 | if ( pop == null ) { |
|
3380 | pop = context; |
|
3381 | } |
|
3382 | ||
3383 | Expr.relative[ cur ]( checkSet, pop, contextXML ); |
|
3384 | } |
|
3385 | ||
3386 | } else { |
|
3387 | checkSet = parts = []; |
|
3388 | } |
|
3389 | } |
|
3390 | ||
3391 | if ( !checkSet ) { |
|
3392 | checkSet = set; |
|
3393 | } |
|
3394 | ||
3395 | if ( !checkSet ) { |
|
3396 | Sizzle.error( cur || selector ); |
|
3397 | } |
|
3398 | ||
3399 | if ( toString.call(checkSet) === "[object Array]" ) { |
|
3400 | if ( !prune ) { |
|
3401 | results.push.apply( results, checkSet ); |
|
3402 | ||
3403 | } else if ( context && context.nodeType === 1 ) { |
|
3404 | for ( i = 0; checkSet[i] != null; i++ ) { |
|
3405 | if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { |
|
3406 | results.push( set[i] ); |
|
3407 | } |
|
3408 | } |
|
3409 | ||
3410 | } else { |
|
3411 | for ( i = 0; checkSet[i] != null; i++ ) { |
|
3412 | if ( checkSet[i] && checkSet[i].nodeType === 1 ) { |
|
3413 | results.push( set[i] ); |
|
3414 | } |
|
3415 | } |
|
3416 | } |
|
3417 | ||
3418 | } else { |
|
3419 | makeArray( checkSet, results ); |
|
3420 | } |
|
3421 | ||
3422 | if ( extra ) { |
|
3423 | Sizzle( extra, origContext, results, seed ); |
|
3424 | Sizzle.uniqueSort( results ); |
|
3425 | } |
|
3426 | ||
3427 | return results; |
|
3428 | }; |
|
3429 | ||
3430 | Sizzle.uniqueSort = function( results ) { |
|
3431 | if ( sortOrder ) { |