@@ 4086-4176 (lines=91) @@ | ||
4083 | return { set: set, expr: expr }; |
|
4084 | }; |
|
4085 | ||
4086 | Sizzle.filter = function( expr, set, inplace, not ) { |
|
4087 | var match, anyFound, |
|
4088 | type, found, item, filter, left, |
|
4089 | i, pass, |
|
4090 | old = expr, |
|
4091 | result = [], |
|
4092 | curLoop = set, |
|
4093 | isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); |
|
4094 | ||
4095 | while ( expr && set.length ) { |
|
4096 | for ( type in Expr.filter ) { |
|
4097 | if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { |
|
4098 | filter = Expr.filter[ type ]; |
|
4099 | left = match[1]; |
|
4100 | ||
4101 | anyFound = false; |
|
4102 | ||
4103 | match.splice(1,1); |
|
4104 | ||
4105 | if ( left.substr( left.length - 1 ) === "\\" ) { |
|
4106 | continue; |
|
4107 | } |
|
4108 | ||
4109 | if ( curLoop === result ) { |
|
4110 | result = []; |
|
4111 | } |
|
4112 | ||
4113 | if ( Expr.preFilter[ type ] ) { |
|
4114 | match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); |
|
4115 | ||
4116 | if ( !match ) { |
|
4117 | anyFound = found = true; |
|
4118 | ||
4119 | } else if ( match === true ) { |
|
4120 | continue; |
|
4121 | } |
|
4122 | } |
|
4123 | ||
4124 | if ( match ) { |
|
4125 | for ( i = 0; (item = curLoop[i]) != null; i++ ) { |
|
4126 | if ( item ) { |
|
4127 | found = filter( item, match, i, curLoop ); |
|
4128 | pass = not ^ found; |
|
4129 | ||
4130 | if ( inplace && found != null ) { |
|
4131 | if ( pass ) { |
|
4132 | anyFound = true; |
|
4133 | ||
4134 | } else { |
|
4135 | curLoop[i] = false; |
|
4136 | } |
|
4137 | ||
4138 | } else if ( pass ) { |
|
4139 | result.push( item ); |
|
4140 | anyFound = true; |
|
4141 | } |
|
4142 | } |
|
4143 | } |
|
4144 | } |
|
4145 | ||
4146 | if ( found !== undefined ) { |
|
4147 | if ( !inplace ) { |
|
4148 | curLoop = result; |
|
4149 | } |
|
4150 | ||
4151 | expr = expr.replace( Expr.match[ type ], "" ); |
|
4152 | ||
4153 | if ( !anyFound ) { |
|
4154 | return []; |
|
4155 | } |
|
4156 | ||
4157 | break; |
|
4158 | } |
|
4159 | } |
|
4160 | } |
|
4161 | ||
4162 | // Improper expression |
|
4163 | if ( expr === old ) { |
|
4164 | if ( anyFound == null ) { |
|
4165 | Sizzle.error( expr ); |
|
4166 | ||
4167 | } else { |
|
4168 | break; |
|
4169 | } |
|
4170 | } |
|
4171 | ||
4172 | old = expr; |
|
4173 | } |
|
4174 | ||
4175 | return curLoop; |
|
4176 | }; |
|
4177 | ||
4178 | Sizzle.error = function( msg ) { |
|
4179 | throw new Error( "Syntax error, unrecognized expression: " + msg ); |
@@ 3491-3580 (lines=90) @@ | ||
3488 | return { set: set, expr: expr }; |
|
3489 | }; |
|
3490 | ||
3491 | Sizzle.filter = function( expr, set, inplace, not ) { |
|
3492 | var match, anyFound, |
|
3493 | old = expr, |
|
3494 | result = [], |
|
3495 | curLoop = set, |
|
3496 | isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); |
|
3497 | ||
3498 | while ( expr && set.length ) { |
|
3499 | for ( var type in Expr.filter ) { |
|
3500 | if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { |
|
3501 | var found, item, |
|
3502 | filter = Expr.filter[ type ], |
|
3503 | left = match[1]; |
|
3504 | ||
3505 | anyFound = false; |
|
3506 | ||
3507 | match.splice(1,1); |
|
3508 | ||
3509 | if ( left.substr( left.length - 1 ) === "\\" ) { |
|
3510 | continue; |
|
3511 | } |
|
3512 | ||
3513 | if ( curLoop === result ) { |
|
3514 | result = []; |
|
3515 | } |
|
3516 | ||
3517 | if ( Expr.preFilter[ type ] ) { |
|
3518 | match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); |
|
3519 | ||
3520 | if ( !match ) { |
|
3521 | anyFound = found = true; |
|
3522 | ||
3523 | } else if ( match === true ) { |
|
3524 | continue; |
|
3525 | } |
|
3526 | } |
|
3527 | ||
3528 | if ( match ) { |
|
3529 | for ( var i = 0; (item = curLoop[i]) != null; i++ ) { |
|
3530 | if ( item ) { |
|
3531 | found = filter( item, match, i, curLoop ); |
|
3532 | var pass = not ^ !!found; |
|
3533 | ||
3534 | if ( inplace && found != null ) { |
|
3535 | if ( pass ) { |
|
3536 | anyFound = true; |
|
3537 | ||
3538 | } else { |
|
3539 | curLoop[i] = false; |
|
3540 | } |
|
3541 | ||
3542 | } else if ( pass ) { |
|
3543 | result.push( item ); |
|
3544 | anyFound = true; |
|
3545 | } |
|
3546 | } |
|
3547 | } |
|
3548 | } |
|
3549 | ||
3550 | if ( found !== undefined ) { |
|
3551 | if ( !inplace ) { |
|
3552 | curLoop = result; |
|
3553 | } |
|
3554 | ||
3555 | expr = expr.replace( Expr.match[ type ], "" ); |
|
3556 | ||
3557 | if ( !anyFound ) { |
|
3558 | return []; |
|
3559 | } |
|
3560 | ||
3561 | break; |
|
3562 | } |
|
3563 | } |
|
3564 | } |
|
3565 | ||
3566 | // Improper expression |
|
3567 | if ( expr === old ) { |
|
3568 | if ( anyFound == null ) { |
|
3569 | Sizzle.error( expr ); |
|
3570 | ||
3571 | } else { |
|
3572 | break; |
|
3573 | } |
|
3574 | } |
|
3575 | ||
3576 | old = expr; |
|
3577 | } |
|
3578 | ||
3579 | return curLoop; |
|
3580 | }; |
|
3581 | ||
3582 | Sizzle.error = function( msg ) { |
|
3583 | throw "Syntax error, unrecognized expression: " + msg; |