Révision 2c8c2b87
Ajouté par Assos Assos il y a presque 9 ans
drupal7/sites/all/modules/jquery_update/replace/jquery/1.8/jquery.js | ||
---|---|---|
1 | 1 |
/*! |
2 |
* jQuery JavaScript Library v1.8.2
|
|
2 |
* jQuery JavaScript Library v1.8.3
|
|
3 | 3 |
* http://jquery.com/ |
4 | 4 |
* |
5 | 5 |
* Includes Sizzle.js |
... | ... | |
9 | 9 |
* Released under the MIT license |
10 | 10 |
* http://jquery.org/license |
11 | 11 |
* |
12 |
* Date: Thu Sep 20 2012 21:13:05 GMT-0400 (Eastern Daylight Time)
|
|
12 |
* Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time)
|
|
13 | 13 |
*/ |
14 | 14 |
(function( window, undefined ) { |
15 | 15 |
var |
... | ... | |
186 | 186 |
selector: "", |
187 | 187 |
|
188 | 188 |
// The current version of jQuery being used |
189 |
jquery: "1.8.2",
|
|
189 |
jquery: "1.8.3",
|
|
190 | 190 |
|
191 | 191 |
// The default length of a jQuery object is 0 |
192 | 192 |
length: 0, |
... | ... | |
999 | 999 |
(function add( args ) { |
1000 | 1000 |
jQuery.each( args, function( _, arg ) { |
1001 | 1001 |
var type = jQuery.type( arg ); |
1002 |
if ( type === "function" && ( !options.unique || !self.has( arg ) ) ) { |
|
1003 |
list.push( arg ); |
|
1002 |
if ( type === "function" ) { |
|
1003 |
if ( !options.unique || !self.has( arg ) ) { |
|
1004 |
list.push( arg ); |
|
1005 |
} |
|
1004 | 1006 |
} else if ( arg && arg.length && type !== "string" ) { |
1005 | 1007 |
// Inspect recursively |
1006 | 1008 |
add( arg ); |
... | ... | |
1253 | 1255 |
clickFn, |
1254 | 1256 |
div = document.createElement("div"); |
1255 | 1257 |
|
1256 |
// Preliminary tests
|
|
1258 |
// Setup
|
|
1257 | 1259 |
div.setAttribute( "className", "t" ); |
1258 | 1260 |
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; |
1259 | 1261 |
|
1262 |
// Support tests won't run in some limited or non-browser environments |
|
1260 | 1263 |
all = div.getElementsByTagName("*"); |
1261 | 1264 |
a = div.getElementsByTagName("a")[ 0 ]; |
1262 |
a.style.cssText = "top:1px;float:left;opacity:.5"; |
|
1263 |
|
|
1264 |
// Can't get basic test support |
|
1265 |
if ( !all || !all.length ) { |
|
1265 |
if ( !all || !a || !all.length ) { |
|
1266 | 1266 |
return {}; |
1267 | 1267 |
} |
1268 | 1268 |
|
1269 |
// First batch of supports tests
|
|
1269 |
// First batch of tests |
|
1270 | 1270 |
select = document.createElement("select"); |
1271 | 1271 |
opt = select.appendChild( document.createElement("option") ); |
1272 | 1272 |
input = div.getElementsByTagName("input")[ 0 ]; |
1273 | 1273 |
|
1274 |
a.style.cssText = "top:1px;float:left;opacity:.5"; |
|
1274 | 1275 |
support = { |
1275 | 1276 |
// IE strips leading whitespace when .innerHTML is used |
1276 | 1277 |
leadingWhitespace: ( div.firstChild.nodeType === 3 ), |
... | ... | |
1312 | 1313 |
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) |
1313 | 1314 |
getSetAttribute: div.className !== "t", |
1314 | 1315 |
|
1315 |
// Tests for enctype support on a form(#6743) |
|
1316 |
// Tests for enctype support on a form (#6743)
|
|
1316 | 1317 |
enctype: !!document.createElement("form").enctype, |
1317 | 1318 |
|
1318 | 1319 |
// Makes sure cloning an html5 element does not cause problems |
... | ... | |
2217 | 2218 |
}, |
2218 | 2219 |
select: { |
2219 | 2220 |
get: function( elem ) { |
2220 |
var value, i, max, option, |
|
2221 |
index = elem.selectedIndex, |
|
2222 |
values = [], |
|
2221 |
var value, option, |
|
2223 | 2222 |
options = elem.options, |
2224 |
one = elem.type === "select-one"; |
|
2225 |
|
|
2226 |
// Nothing was selected |
|
2227 |
if ( index < 0 ) { |
|
2228 |
return null; |
|
2229 |
} |
|
2223 |
index = elem.selectedIndex, |
|
2224 |
one = elem.type === "select-one" || index < 0, |
|
2225 |
values = one ? null : [], |
|
2226 |
max = one ? index + 1 : options.length, |
|
2227 |
i = index < 0 ? |
|
2228 |
max : |
|
2229 |
one ? index : 0; |
|
2230 | 2230 |
|
2231 | 2231 |
// Loop through all the selected options |
2232 |
i = one ? index : 0; |
|
2233 |
max = one ? index + 1 : options.length; |
|
2234 | 2232 |
for ( ; i < max; i++ ) { |
2235 | 2233 |
option = options[ i ]; |
2236 | 2234 |
|
2237 |
// Don't return options that are disabled or in a disabled optgroup |
|
2238 |
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && |
|
2239 |
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { |
|
2235 |
// oldIE doesn't update selected after form reset (#2551) |
|
2236 |
if ( ( option.selected || i === index ) && |
|
2237 |
// Don't return options that are disabled or in a disabled optgroup |
|
2238 |
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && |
|
2239 |
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { |
|
2240 | 2240 |
|
2241 | 2241 |
// Get the specific value for the option |
2242 | 2242 |
value = jQuery( option ).val(); |
... | ... | |
2251 | 2251 |
} |
2252 | 2252 |
} |
2253 | 2253 |
|
2254 |
// Fixes Bug #2551 -- select.val() broken in IE after form.reset() |
|
2255 |
if ( one && !values.length && options.length ) { |
|
2256 |
return jQuery( options[ index ] ).val(); |
|
2257 |
} |
|
2258 |
|
|
2259 | 2254 |
return values; |
2260 | 2255 |
}, |
2261 | 2256 |
|
... | ... | |
3233 | 3228 |
|
3234 | 3229 |
if ( elem.detachEvent ) { |
3235 | 3230 |
|
3236 |
// #8545, #7054, preventing memory leaks for custom events in IE6-8 –
|
|
3231 |
// #8545, #7054, preventing memory leaks for custom events in IE6-8 |
|
3237 | 3232 |
// detachEvent needed property on element, by name of that event, to properly expose it to GC |
3238 | 3233 |
if ( typeof elem[ name ] === "undefined" ) { |
3239 | 3234 |
elem[ name ] = null; |
... | ... | |
3432 | 3427 |
jQuery.event.add( this, "beforeactivate._change", function( e ) { |
3433 | 3428 |
var elem = e.target; |
3434 | 3429 |
|
3435 |
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { |
|
3436 |
jQuery.event.add( elem, "change._change", function( event ) { |
|
3437 |
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { |
|
3438 |
jQuery.event.simulate( "change", this.parentNode, event, true ); |
|
3430 |
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { |
|
3431 |
jQuery.event.add( elem, "change._change", function( event ) { |
|
3432 |
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { |
|
3433 |
jQuery.event.simulate( "change", this.parentNode, event, true ); |
|
3434 |
} |
|
3435 |
}); |
|
3436 |
jQuery._data( elem, "_change_attached", true ); |
|
3437 |
} |
|
3438 |
}); |
|
3439 |
}, |
|
3440 |
|
|
3441 |
handle: function( event ) { |
|
3442 |
var elem = event.target; |
|
3443 |
|
|
3444 |
// Swallow native change events from checkbox/radio, we already triggered them above |
|
3445 |
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { |
|
3446 |
return event.handleObj.handler.apply( this, arguments ); |
|
3447 |
} |
|
3448 |
}, |
|
3449 |
|
|
3450 |
teardown: function() { |
|
3451 |
jQuery.event.remove( this, "._change" ); |
|
3452 |
|
|
3453 |
return !rformElems.test( this.nodeName ); |
|
3454 |
} |
|
3455 |
}; |
|
3456 |
} |
|
3457 |
|
|
3458 |
// Create "bubbling" focus and blur events |
|
3459 |
if ( !jQuery.support.focusinBubbles ) { |
|
3460 |
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
|
3461 |
|
|
3462 |
// Attach a single capturing handler while someone wants focusin/focusout |
|
3463 |
var attaches = 0, |
|
3464 |
handler = function( event ) { |
|
3465 |
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); |
|
3466 |
}; |
|
3467 |
|
|
3468 |
jQuery.event.special[ fix ] = { |
|
3469 |
setup: function() { |
|
3470 |
if ( attaches++ === 0 ) { |
|
3471 |
document.addEventListener( orig, handler, true ); |
|
3472 |
} |
|
3473 |
}, |
|
3474 |
teardown: function() { |
|
3475 |
if ( --attaches === 0 ) { |
|
3476 |
document.removeEventListener( orig, handler, true ); |
|
3477 |
} |
|
3478 |
} |
|
3479 |
}; |
|
3480 |
}); |
|
3481 |
} |
|
3482 |
|
|
3483 |
jQuery.fn.extend({ |
|
3484 |
|
|
3485 |
on: function( types, selector, data, fn, /*INTERNAL*/ one ) { |
|
3486 |
var origFn, type; |
|
3487 |
|
|
3488 |
// Types can be a map of types/handlers |
|
3489 |
if ( typeof types === "object" ) { |
|
3490 |
// ( types-Object, selector, data ) |
|
3491 |
if ( typeof selector !== "string" ) { // && selector != null |
|
3492 |
// ( types-Object, data ) |
|
3493 |
data = data || selector; |
|
3494 |
selector = undefined; |
|
3495 |
} |
|
3496 |
for ( type in types ) { |
|
3497 |
this.on( type, selector, data, types[ type ], one ); |
|
3498 |
} |
|
3499 |
return this; |
|
3500 |
} |
|
3501 |
|
|
3502 |
if ( data == null && fn == null ) { |
|
3503 |
// ( types, fn ) |
|
3504 |
fn = selector; |
|
3505 |
data = selector = undefined; |
|
3506 |
} else if ( fn == null ) { |
|
3507 |
if ( typeof selector === "string" ) { |
|
3508 |
// ( types, selector, fn ) |
|
3509 |
fn = data; |
|
3510 |
data = undefined; |
|
3511 |
} else { |
|
3512 |
// ( types, data, fn ) |
|
3513 |
fn = data; |
|
3514 |
data = selector; |
|
3515 |
selector = undefined; |
|
3516 |
} |
|
3517 |
} |
|
3518 |
if ( fn === false ) { |
|
3519 |
fn = returnFalse; |
|
3520 |
} else if ( !fn ) { |
|
3521 |
return this; |
|
3522 |
} |
|
3523 |
|
|
3524 |
if ( one === 1 ) { |
|
3525 |
origFn = fn; |
|
3526 |
fn = function( event ) { |
|
3527 |
// Can use an empty set, since event contains the info |
|
3528 |
jQuery().off( event ); |
|
3529 |
return origFn.apply( this, arguments ); |
|
3530 |
}; |
|
3531 |
// Use same guid so caller can remove using origFn |
|
3532 |
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); |
|
3533 |
} |
|
3534 |
return this.each( function() { |
|
3535 |
jQuery.event.add( this, types, fn, data, selector ); |
|
3536 |
}); |
|
3537 |
}, |
|
3538 |
one: function( types, selector, data, fn ) { |
|
3539 |
return this.on( types, selector, data, fn, 1 ); |
|
3540 |
}, |
|
3541 |
off: function( types, selector, fn ) { |
|
3542 |
var handleObj, type; |
|
3543 |
if ( types && types.preventDefault && types.handleObj ) { |
|
3544 |
// ( event ) dispatched jQuery.Event |
|
3545 |
handleObj = types.handleObj; |
|
3546 |
jQuery( types.delegateTarget ).off( |
|
3547 |
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, |
|
3548 |
handleObj.selector, |
|
3549 |
handleObj.handler |
|
3550 |
); |
|
3551 |
return this; |
|
3552 |
} |
|
3553 |
if ( typeof types === "object" ) { |
|
3554 |
// ( types-object [, selector] ) |
|
3555 |
for ( type in types ) { |
|
3556 |
this.off( type, selector, types[ type ] ); |
|
3557 |
} |
|
3558 |
return this; |
|
3559 |
} |
|
3560 |
if ( selector === false || typeof selector === "function" ) { |
|
3561 |
// ( types [, fn] ) |
|
3562 |
fn = selector; |
|
3563 |
selector = undefined; |
|
3564 |
} |
|
3565 |
if ( fn === false ) { |
|
3566 |
fn = returnFalse; |
|
3567 |
} |
|
3568 |
return this.each(function() { |
|
3569 |
jQuery.event.remove( this, types, fn, selector ); |
|
3570 |
}); |
|
3571 |
}, |
|
3572 |
|
|
3573 |
bind: function( types, data, fn ) { |
|
3574 |
return this.on( types, null, data, fn ); |
|
3575 |
}, |
|
3576 |
unbind: function( types, fn ) { |
|
3577 |
return this.off( types, null, fn ); |
|
3578 |
}, |
|
3579 |
|
|
3580 |
live: function( types, data, fn ) { |
|
3581 |
jQuery( this.context ).on( types, this.selector, data, fn ); |
|
3582 |
return this; |
|
3583 |
}, |
|
3584 |
die: function( types, fn ) { |
|
3585 |
jQuery( this.context ).off( types, this.selector || "**", fn ); |
|
3586 |
return this; |
|
3587 |
}, |
|
3588 |
|
|
3589 |
delegate: function( selector, types, data, fn ) { |
|
3590 |
return this.on( types, selector, data, fn ); |
|
3591 |
}, |
|
3592 |
undelegate: function( selector, types, fn ) { |
|
3593 |
// ( namespace ) or ( selector, types [, fn] ) |
|
3594 |
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); |
|
3595 |
}, |
|
3596 |
|
|
3597 |
trigger: function( type, data ) { |
|
3598 |
return this.each(function() { |
|
3599 |
jQuery.event.trigger( type, data, this ); |
|
3600 |
}); |
|
3601 |
}, |
|
3602 |
triggerHandler: function( type, data ) { |
|
3603 |
if ( this[0] ) { |
|
3604 |
return jQuery.event.trigger( type, data, this[0], true ); |
|
3605 |
} |
|
3606 |
}, |
|
3607 |
|
|
3608 |
toggle: function( fn ) { |
|
3609 |
// Save reference to arguments for access in closure |
|
3610 |
var args = arguments, |
|
3611 |
guid = fn.guid || jQuery.guid++, |
|
3612 |
i = 0, |
|
3613 |
toggler = function( event ) { |
|
3614 |
// Figure out which function to execute |
|
3615 |
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; |
|
3616 |
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); |
|
3617 |
|
|
3618 |
// Make sure that clicks stop |
|
3619 |
event.preventDefault(); |
|
3620 |
|
|
3621 |
// and execute the function |
|
3622 |
return args[ lastToggle ].apply( this, arguments ) || false; |
|
3623 |
}; |
|
3624 |
|
|
3625 |
// link all the functions, so any of them can unbind this click handler |
|
3626 |
toggler.guid = guid; |
|
3627 |
while ( i < args.length ) { |
|
3628 |
args[ i++ ].guid = guid; |
|
3629 |
} |
|
3630 |
|
|
3631 |
return this.click( toggler ); |
|
3632 |
}, |
|
3633 |
|
|
3634 |
hover: function( fnOver, fnOut ) { |
|
3635 |
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
|
3636 |
} |
|
3637 |
}); |
|
3638 |
|
|
3639 |
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + |
|
3640 |
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
|
3641 |
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { |
|
3642 |
|
|
3643 |
// Handle event binding |
|
3644 |
jQuery.fn[ name ] = function( data, fn ) { |
|
3645 |
if ( fn == null ) { |
|
3646 |
fn = data; |
|
3647 |
data = null; |
|
3648 |
} |
|
3649 |
|
|
3650 |
return arguments.length > 0 ? |
|
3651 |
this.on( name, null, data, fn ) : |
|
3652 |
this.trigger( name ); |
|
3653 |
}; |
|
3654 |
|
|
3655 |
if ( rkeyEvent.test( name ) ) { |
|
3656 |
jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; |
|
3657 |
} |
|
3658 |
|
|
3659 |
if ( rmouseEvent.test( name ) ) { |
|
3660 |
jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; |
|
3661 |
} |
|
3662 |
}); |
|
3663 |
/*! |
|
3664 |
* Sizzle CSS Selector Engine |
|
3665 |
* Copyright 2012 jQuery Foundation and other contributors |
|
3666 |
* Released under the MIT license |
|
3667 |
* http://sizzlejs.com/ |
|
3668 |
*/ |
|
3669 |
(function( window, undefined ) { |
|
3670 |
|
|
3671 |
var cachedruns, |
|
3672 |
assertGetIdNotName, |
|
3673 |
Expr, |
|
3674 |
getText, |
|
3675 |
isXML, |
|
3676 |
contains, |
|
3677 |
compile, |
|
3678 |
sortOrder, |
|
3679 |
hasDuplicate, |
|
3680 |
outermostContext, |
|
3681 |
|
|
3682 |
baseHasDuplicate = true, |
|
3683 |
strundefined = "undefined", |
|
3684 |
|
|
3685 |
expando = ( "sizcache" + Math.random() ).replace( ".", "" ), |
|
3686 |
|
|
3687 |
Token = String, |
|
3688 |
document = window.document, |
|
3689 |
docElem = document.documentElement, |
|
3690 |
dirruns = 0, |
|
3691 |
done = 0, |
|
3692 |
pop = [].pop, |
|
3693 |
push = [].push, |
|
3694 |
slice = [].slice, |
|
3695 |
// Use a stripped-down indexOf if a native one is unavailable |
|
3696 |
indexOf = [].indexOf || function( elem ) { |
|
3697 |
var i = 0, |
|
3698 |
len = this.length; |
|
3699 |
for ( ; i < len; i++ ) { |
|
3700 |
if ( this[i] === elem ) { |
|
3701 |
return i; |
|
3702 |
} |
|
3703 |
} |
|
3704 |
return -1; |
|
3705 |
}, |
|
3706 |
|
|
3707 |
// Augment a function for special use by Sizzle |
|
3708 |
markFunction = function( fn, value ) { |
|
3709 |
fn[ expando ] = value == null || value; |
|
3710 |
return fn; |
|
3711 |
}, |
|
3712 |
|
|
3713 |
createCache = function() { |
|
3714 |
var cache = {}, |
|
3715 |
keys = []; |
|
3716 |
|
|
3717 |
return markFunction(function( key, value ) { |
|
3718 |
// Only keep the most recent entries |
|
3719 |
if ( keys.push( key ) > Expr.cacheLength ) { |
|
3720 |
delete cache[ keys.shift() ]; |
|
3721 |
} |
|
3722 |
|
|
3723 |
// Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157) |
|
3724 |
return (cache[ key + " " ] = value); |
|
3725 |
}, cache ); |
|
3726 |
}, |
|
3727 |
|
|
3728 |
classCache = createCache(), |
|
3729 |
tokenCache = createCache(), |
|
3730 |
compilerCache = createCache(), |
|
3731 |
|
|
3732 |
// Regex |
|
3733 |
|
|
3734 |
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace |
|
3735 |
whitespace = "[\\x20\\t\\r\\n\\f]", |
|
3736 |
// http://www.w3.org/TR/css3-syntax/#characters |
|
3737 |
characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", |
|
3738 |
|
|
3739 |
// Loosely modeled on CSS identifier characters |
|
3740 |
// An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) |
|
3741 |
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier |
|
3742 |
identifier = characterEncoding.replace( "w", "w#" ), |
|
3743 |
|
|
3744 |
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors |
|
3745 |
operators = "([*^$|!~]?=)", |
|
3746 |
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + |
|
3747 |
"*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", |
|
3748 |
|
|
3749 |
// Prefer arguments not in parens/brackets, |
|
3750 |
// then attribute selectors and non-pseudos (denoted by :), |
|
3751 |
// then anything else |
|
3752 |
// These preferences are here to reduce the number of selectors |
|
3753 |
// needing tokenize in the PSEUDO preFilter |
|
3754 |
pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", |
|
3755 |
|
|
3756 |
// For matchExpr.POS and matchExpr.needsContext |
|
3757 |
pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + |
|
3758 |
"*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", |
|
3759 |
|
|
3760 |
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
|
3761 |
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), |
|
3762 |
|
|
3763 |
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), |
|
3764 |
rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), |
|
3765 |
rpseudo = new RegExp( pseudos ), |
|
3766 |
|
|
3767 |
// Easily-parseable/retrievable ID or TAG or CLASS selectors |
|
3768 |
rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, |
|
3769 |
|
|
3770 |
rnot = /^:not/, |
|
3771 |
rsibling = /[\x20\t\r\n\f]*[+~]/, |
|
3772 |
rendsWithNot = /:not\($/, |
|
3773 |
|
|
3774 |
rheader = /h\d/i, |
|
3775 |
rinputs = /input|select|textarea|button/i, |
|
3776 |
|
|
3777 |
rbackslash = /\\(?!\\)/g, |
|
3778 |
|
|
3779 |
matchExpr = { |
|
3780 |
"ID": new RegExp( "^#(" + characterEncoding + ")" ), |
|
3781 |
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), |
|
3782 |
"NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), |
|
3783 |
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), |
|
3784 |
"ATTR": new RegExp( "^" + attributes ), |
|
3785 |
"PSEUDO": new RegExp( "^" + pseudos ), |
|
3786 |
"POS": new RegExp( pos, "i" ), |
|
3787 |
"CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace + |
|
3788 |
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + |
|
3789 |
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
|
3790 |
// For use in libraries implementing .is() |
|
3791 |
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" ) |
|
3792 |
}, |
|
3793 |
|
|
3794 |
// Support |
|
3795 |
|
|
3796 |
// Used for testing something on an element |
|
3797 |
assert = function( fn ) { |
|
3798 |
var div = document.createElement("div"); |
|
3799 |
|
|
3800 |
try { |
|
3801 |
return fn( div ); |
|
3802 |
} catch (e) { |
|
3803 |
return false; |
|
3804 |
} finally { |
|
3805 |
// release memory in IE |
|
3806 |
div = null; |
|
3807 |
} |
|
3808 |
}, |
|
3809 |
|
|
3810 |
// Check if getElementsByTagName("*") returns only elements |
|
3811 |
assertTagNameNoComments = assert(function( div ) { |
|
3812 |
div.appendChild( document.createComment("") ); |
|
3813 |
return !div.getElementsByTagName("*").length; |
|
3814 |
}), |
|
3815 |
|
|
3816 |
// Check if getAttribute returns normalized href attributes |
|
3817 |
assertHrefNotNormalized = assert(function( div ) { |
|
3818 |
div.innerHTML = "<a href='#'></a>"; |
|
3819 |
return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && |
|
3820 |
div.firstChild.getAttribute("href") === "#"; |
|
3821 |
}), |
|
3822 |
|
|
3823 |
// Check if attributes should be retrieved by attribute nodes |
|
3824 |
assertAttributes = assert(function( div ) { |
|
3825 |
div.innerHTML = "<select></select>"; |
|
3826 |
var type = typeof div.lastChild.getAttribute("multiple"); |
|
3827 |
// IE8 returns a string for some attributes even when not present |
|
3828 |
return type !== "boolean" && type !== "string"; |
|
3829 |
}), |
|
3830 |
|
|
3831 |
// Check if getElementsByClassName can be trusted |
|
3832 |
assertUsableClassName = assert(function( div ) { |
|
3833 |
// Opera can't find a second classname (in 9.6) |
|
3834 |
div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; |
|
3835 |
if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { |
|
3836 |
return false; |
|
3837 |
} |
|
3838 |
|
|
3839 |
// Safari 3.2 caches class attributes and doesn't catch changes |
|
3840 |
div.lastChild.className = "e"; |
|
3841 |
return div.getElementsByClassName("e").length === 2; |
|
3842 |
}), |
|
3843 |
|
|
3844 |
// Check if getElementById returns elements by name |
|
3845 |
// Check if getElementsByName privileges form controls or returns elements by ID |
|
3846 |
assertUsableName = assert(function( div ) { |
|
3847 |
// Inject content |
|
3848 |
div.id = expando + 0; |
|
3849 |
div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; |
|
3850 |
docElem.insertBefore( div, docElem.firstChild ); |
|
3851 |
|
|
3852 |
// Test |
|
3853 |
var pass = document.getElementsByName && |
|
3854 |
// buggy browsers will return fewer than the correct 2 |
|
3855 |
document.getElementsByName( expando ).length === 2 + |
|
3856 |
// buggy browsers will return more than the correct 0 |
|
3857 |
document.getElementsByName( expando + 0 ).length; |
|
3858 |
assertGetIdNotName = !document.getElementById( expando ); |
|
3859 |
|
|
3860 |
// Cleanup |
|
3861 |
docElem.removeChild( div ); |
|
3862 |
|
|
3863 |
return pass; |
|
3864 |
}); |
|
3865 |
|
|
3866 |
// If slice is not available, provide a backup |
|
3867 |
try { |
|
3868 |
slice.call( docElem.childNodes, 0 )[0].nodeType; |
|
3869 |
} catch ( e ) { |
|
3870 |
slice = function( i ) { |
|
3871 |
var elem, |
|
3872 |
results = []; |
|
3873 |
for ( ; (elem = this[i]); i++ ) { |
|
3874 |
results.push( elem ); |
|
3875 |
} |
|
3876 |
return results; |
|
3877 |
}; |
|
3878 |
} |
|
3879 |
|
|
3880 |
function Sizzle( selector, context, results, seed ) { |
|
3881 |
results = results || []; |
|
3882 |
context = context || document; |
|
3883 |
var match, elem, xml, m, |
|
3884 |
nodeType = context.nodeType; |
|
3885 |
|
|
3886 |
if ( !selector || typeof selector !== "string" ) { |
|
3887 |
return results; |
|
3888 |
} |
|
3889 |
|
|
3890 |
if ( nodeType !== 1 && nodeType !== 9 ) { |
|
3891 |
return []; |
|
3892 |
} |
|
3893 |
|
|
3894 |
xml = isXML( context ); |
|
3895 |
|
|
3896 |
if ( !xml && !seed ) { |
|
3897 |
if ( (match = rquickExpr.exec( selector )) ) { |
|
3898 |
// Speed-up: Sizzle("#ID") |
|
3899 |
if ( (m = match[1]) ) { |
|
3900 |
if ( nodeType === 9 ) { |
|
3901 |
elem = context.getElementById( m ); |
|
3902 |
// Check parentNode to catch when Blackberry 4.6 returns |
|
3903 |
// nodes that are no longer in the document #6963 |
|
3904 |
if ( elem && elem.parentNode ) { |
|
3905 |
// Handle the case where IE, Opera, and Webkit return items |
|
3906 |
// by name instead of ID |
|
3907 |
if ( elem.id === m ) { |
|
3908 |
results.push( elem ); |
|
3909 |
return results; |
|
3910 |
} |
|
3911 |
} else { |
|
3912 |
return results; |
|
3913 |
} |
|
3914 |
} else { |
|
3915 |
// Context is not a document |
|
3916 |
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && |
|
3917 |
contains( context, elem ) && elem.id === m ) { |
|
3918 |
results.push( elem ); |
|
3919 |
return results; |
|
3920 |
} |
|
3921 |
} |
|
3922 |
|
|
3923 |
// Speed-up: Sizzle("TAG") |
|
3924 |
} else if ( match[2] ) { |
|
3925 |
push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); |
|
3926 |
return results; |
|
3927 |
|
|
3928 |
// Speed-up: Sizzle(".CLASS") |
|
3929 |
} else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) { |
|
3930 |
push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); |
|
3931 |
return results; |
|
3932 |
} |
|
3933 |
} |
|
3934 |
} |
|
3935 |
|
|
3936 |
// All others |
|
3937 |
return select( selector.replace( rtrim, "$1" ), context, results, seed, xml ); |
|
3938 |
} |
|
3939 |
|
|
3940 |
Sizzle.matches = function( expr, elements ) { |
|
3941 |
return Sizzle( expr, null, null, elements ); |
|
3942 |
}; |
|
3943 |
|
|
3944 |
Sizzle.matchesSelector = function( elem, expr ) { |
|
3945 |
return Sizzle( expr, null, null, [ elem ] ).length > 0; |
|
3946 |
}; |
|
3947 |
|
|
3948 |
// Returns a function to use in pseudos for input types |
|
3949 |
function createInputPseudo( type ) { |
|
3950 |
return function( elem ) { |
|
3951 |
var name = elem.nodeName.toLowerCase(); |
|
3952 |
return name === "input" && elem.type === type; |
|
3953 |
}; |
|
3954 |
} |
|
3955 |
|
|
3956 |
// Returns a function to use in pseudos for buttons |
|
3957 |
function createButtonPseudo( type ) { |
|
3958 |
return function( elem ) { |
|
3959 |
var name = elem.nodeName.toLowerCase(); |
|
3960 |
return (name === "input" || name === "button") && elem.type === type; |
|
3961 |
}; |
|
3962 |
} |
|
3963 |
|
|
3964 |
// Returns a function to use in pseudos for positionals |
|
3965 |
function createPositionalPseudo( fn ) { |
|
3966 |
return markFunction(function( argument ) { |
|
3967 |
argument = +argument; |
|
3968 |
return markFunction(function( seed, matches ) { |
|
3969 |
var j, |
|
3970 |
matchIndexes = fn( [], seed.length, argument ), |
|
3971 |
i = matchIndexes.length; |
|
3972 |
|
|
3973 |
// Match elements found at the specified indexes |
|
3974 |
while ( i-- ) { |
|
3975 |
if ( seed[ (j = matchIndexes[i]) ] ) { |
|
3976 |
seed[j] = !(matches[j] = seed[j]); |
|
3977 |
} |
|
3978 |
} |
|
3979 |
}); |
|
3980 |
}); |
|
3981 |
} |
|
3982 |
|
|
3983 |
/** |
|
3984 |
* Utility function for retrieving the text value of an array of DOM nodes |
|
3985 |
* @param {Array|Element} elem |
|
3986 |
*/ |
|
3987 |
getText = Sizzle.getText = function( elem ) { |
|
3988 |
var node, |
|
3989 |
ret = "", |
|
3990 |
i = 0, |
|
3991 |
nodeType = elem.nodeType; |
|
3992 |
|
|
3993 |
if ( nodeType ) { |
|
3994 |
if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { |
|
3995 |
// Use textContent for elements |
|
3996 |
// innerText usage removed for consistency of new lines (see #11153) |
|
3997 |
if ( typeof elem.textContent === "string" ) { |
|
3998 |
return elem.textContent; |
|
3999 |
} else { |
|
4000 |
// Traverse its children |
|
4001 |
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
|
4002 |
ret += getText( elem ); |
|
4003 |
} |
|
4004 |
} |
|
4005 |
} else if ( nodeType === 3 || nodeType === 4 ) { |
|
4006 |
return elem.nodeValue; |
|
4007 |
} |
|
4008 |
// Do not include comment or processing instruction nodes |
|
4009 |
} else { |
|
4010 |
|
|
4011 |
// If no nodeType, this is expected to be an array |
|
4012 |
for ( ; (node = elem[i]); i++ ) { |
|
4013 |
// Do not traverse comment nodes |
|
4014 |
ret += getText( node ); |
|
4015 |
} |
|
4016 |
} |
|
4017 |
return ret; |
|
4018 |
}; |
|
4019 |
|
|
4020 |
isXML = Sizzle.isXML = function( elem ) { |
|
4021 |
// documentElement is verified for cases where it doesn't yet exist |
|
4022 |
// (such as loading iframes in IE - #4833) |
|
4023 |
var documentElement = elem && (elem.ownerDocument || elem).documentElement; |
|
4024 |
return documentElement ? documentElement.nodeName !== "HTML" : false; |
|
4025 |
}; |
|
4026 |
|
|
4027 |
// Element contains another |
|
4028 |
contains = Sizzle.contains = docElem.contains ? |
|
4029 |
function( a, b ) { |
|
4030 |
var adown = a.nodeType === 9 ? a.documentElement : a, |
|
4031 |
bup = b && b.parentNode; |
|
4032 |
return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); |
|
4033 |
} : |
|
4034 |
docElem.compareDocumentPosition ? |
|
4035 |
function( a, b ) { |
|
4036 |
return b && !!( a.compareDocumentPosition( b ) & 16 ); |
|
4037 |
} : |
|
4038 |
function( a, b ) { |
|
4039 |
while ( (b = b.parentNode) ) { |
|
4040 |
if ( b === a ) { |
|
4041 |
return true; |
|
4042 |
} |
|
4043 |
} |
|
4044 |
return false; |
|
4045 |
}; |
|
4046 |
|
|
4047 |
Sizzle.attr = function( elem, name ) { |
|
4048 |
var val, |
|
4049 |
xml = isXML( elem ); |
|
4050 |
|
|
4051 |
if ( !xml ) { |
|
4052 |
name = name.toLowerCase(); |
|
4053 |
} |
|
4054 |
if ( (val = Expr.attrHandle[ name ]) ) { |
|
4055 |
return val( elem ); |
|
4056 |
} |
|
4057 |
if ( xml || assertAttributes ) { |
|
4058 |
return elem.getAttribute( name ); |
|
4059 |
} |
|
4060 |
val = elem.getAttributeNode( name ); |
|
4061 |
return val ? |
|
4062 |
typeof elem[ name ] === "boolean" ? |
|
4063 |
elem[ name ] ? name : null : |
|
4064 |
val.specified ? val.value : null : |
|
4065 |
null; |
|
4066 |
}; |
|
4067 |
|
|
4068 |
Expr = Sizzle.selectors = { |
|
4069 |
|
|
4070 |
// Can be adjusted by the user |
|
4071 |
cacheLength: 50, |
|
4072 |
|
|
4073 |
createPseudo: markFunction, |
|
4074 |
|
|
4075 |
match: matchExpr, |
|
4076 |
|
|
4077 |
// IE6/7 return a modified href |
|
4078 |
attrHandle: assertHrefNotNormalized ? |
|
4079 |
{} : |
|
4080 |
{ |
|
4081 |
"href": function( elem ) { |
|
4082 |
return elem.getAttribute( "href", 2 ); |
|
4083 |
}, |
|
4084 |
"type": function( elem ) { |
|
4085 |
return elem.getAttribute("type"); |
|
4086 |
} |
|
4087 |
}, |
|
4088 |
|
|
4089 |
find: { |
|
4090 |
"ID": assertGetIdNotName ? |
|
4091 |
function( id, context, xml ) { |
|
4092 |
if ( typeof context.getElementById !== strundefined && !xml ) { |
|
4093 |
var m = context.getElementById( id ); |
|
4094 |
// Check parentNode to catch when Blackberry 4.6 returns |
|
4095 |
// nodes that are no longer in the document #6963 |
|
4096 |
return m && m.parentNode ? [m] : []; |
|
4097 |
} |
|
4098 |
} : |
|
4099 |
function( id, context, xml ) { |
|
4100 |
if ( typeof context.getElementById !== strundefined && !xml ) { |
|
4101 |
var m = context.getElementById( id ); |
|
4102 |
|
|
4103 |
return m ? |
|
4104 |
m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? |
|
4105 |
[m] : |
|
4106 |
undefined : |
|
4107 |
[]; |
|
4108 |
} |
|
4109 |
}, |
|
4110 |
|
|
4111 |
"TAG": assertTagNameNoComments ? |
|
4112 |
function( tag, context ) { |
|
4113 |
if ( typeof context.getElementsByTagName !== strundefined ) { |
|
4114 |
return context.getElementsByTagName( tag ); |
|
4115 |
} |
|
4116 |
} : |
|
4117 |
function( tag, context ) { |
|
4118 |
var results = context.getElementsByTagName( tag ); |
|
4119 |
|
|
4120 |
// Filter out possible comments |
|
4121 |
if ( tag === "*" ) { |
|
4122 |
var elem, |
|
4123 |
tmp = [], |
|
4124 |
i = 0; |
|
4125 |
|
|
4126 |
for ( ; (elem = results[i]); i++ ) { |
|
4127 |
if ( elem.nodeType === 1 ) { |
|
4128 |
tmp.push( elem ); |
|
4129 |
} |
|
4130 |
} |
|
4131 |
|
|
4132 |
return tmp; |
|
4133 |
} |
|
4134 |
return results; |
|
4135 |
}, |
|
4136 |
|
|
4137 |
"NAME": assertUsableName && function( tag, context ) { |
|
4138 |
if ( typeof context.getElementsByName !== strundefined ) { |
|
4139 |
return context.getElementsByName( name ); |
|
4140 |
} |
|
4141 |
}, |
|
4142 |
|
|
4143 |
"CLASS": assertUsableClassName && function( className, context, xml ) { |
|
4144 |
if ( typeof context.getElementsByClassName !== strundefined && !xml ) { |
|
4145 |
return context.getElementsByClassName( className ); |
|
4146 |
} |
|
4147 |
} |
|
4148 |
}, |
|
4149 |
|
|
4150 |
relative: { |
|
4151 |
">": { dir: "parentNode", first: true }, |
|
4152 |
" ": { dir: "parentNode" }, |
|
4153 |
"+": { dir: "previousSibling", first: true }, |
|
4154 |
"~": { dir: "previousSibling" } |
|
4155 |
}, |
|
4156 |
|
|
4157 |
preFilter: { |
|
4158 |
"ATTR": function( match ) { |
|
4159 |
match[1] = match[1].replace( rbackslash, "" ); |
|
4160 |
|
|
4161 |
// Move the given value to match[3] whether quoted or unquoted |
|
4162 |
match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); |
|
4163 |
|
|
4164 |
if ( match[2] === "~=" ) { |
|
4165 |
match[3] = " " + match[3] + " "; |
|
4166 |
} |
|
4167 |
|
|
4168 |
return match.slice( 0, 4 ); |
|
4169 |
}, |
|
4170 |
|
|
4171 |
"CHILD": function( match ) { |
|
4172 |
/* matches from matchExpr["CHILD"] |
|
4173 |
1 type (only|nth|...) |
|
4174 |
2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
|
4175 |
3 xn-component of xn+y argument ([+-]?\d*n|) |
|
4176 |
4 sign of xn-component |
|
4177 |
5 x of xn-component |
|
4178 |
6 sign of y-component |
|
4179 |
7 y of y-component |
|
4180 |
*/ |
|
4181 |
match[1] = match[1].toLowerCase(); |
|
4182 |
|
|
4183 |
if ( match[1] === "nth" ) { |
|
4184 |
// nth-child requires argument |
|
4185 |
if ( !match[2] ) { |
|
4186 |
Sizzle.error( match[0] ); |
|
4187 |
} |
|
4188 |
|
|
4189 |
// numeric x and y parameters for Expr.filter.CHILD |
|
4190 |
// remember that false/true cast respectively to 0/1 |
|
4191 |
match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); |
|
4192 |
match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); |
|
4193 |
|
|
4194 |
// other types prohibit arguments |
|
4195 |
} else if ( match[2] ) { |
|
4196 |
Sizzle.error( match[0] ); |
|
4197 |
} |
|
4198 |
|
|
4199 |
return match; |
|
4200 |
}, |
|
4201 |
|
|
4202 |
"PSEUDO": function( match ) { |
|
4203 |
var unquoted, excess; |
|
4204 |
if ( matchExpr["CHILD"].test( match[0] ) ) { |
|
4205 |
return null; |
|
4206 |
} |
|
4207 |
|
|
4208 |
if ( match[3] ) { |
|
4209 |
match[2] = match[3]; |
|
4210 |
} else if ( (unquoted = match[4]) ) { |
|
4211 |
// Only check arguments that contain a pseudo |
|
4212 |
if ( rpseudo.test(unquoted) && |
|
4213 |
// Get excess from tokenize (recursively) |
|
4214 |
(excess = tokenize( unquoted, true )) && |
|
4215 |
// advance to the next closing parenthesis |
|
4216 |
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { |
|
4217 |
|
|
4218 |
// excess is a negative index |
|
4219 |
unquoted = unquoted.slice( 0, excess ); |
|
4220 |
match[0] = match[0].slice( 0, excess ); |
|
4221 |
} |
|
4222 |
match[2] = unquoted; |
|
4223 |
} |
|
4224 |
|
|
4225 |
// Return only captures needed by the pseudo filter method (type and argument) |
|
4226 |
return match.slice( 0, 3 ); |
|
4227 |
} |
|
4228 |
}, |
|
4229 |
|
|
4230 |
filter: { |
|
4231 |
"ID": assertGetIdNotName ? |
|
4232 |
function( id ) { |
|
4233 |
id = id.replace( rbackslash, "" ); |
|
4234 |
return function( elem ) { |
|
4235 |
return elem.getAttribute("id") === id; |
|
4236 |
}; |
|
4237 |
} : |
|
4238 |
function( id ) { |
|
4239 |
id = id.replace( rbackslash, "" ); |
|
4240 |
return function( elem ) { |
|
4241 |
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); |
|
4242 |
return node && node.value === id; |
|
4243 |
}; |
|
4244 |
}, |
|
4245 |
|
|
4246 |
"TAG": function( nodeName ) { |
|
4247 |
if ( nodeName === "*" ) { |
|
4248 |
return function() { return true; }; |
|
4249 |
} |
|
4250 |
nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); |
|
4251 |
|
|
4252 |
return function( elem ) { |
|
4253 |
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; |
|
4254 |
}; |
|
4255 |
}, |
|
4256 |
|
|
4257 |
"CLASS": function( className ) { |
|
4258 |
var pattern = classCache[ expando ][ className + " " ]; |
|
4259 |
|
|
4260 |
return pattern || |
|
4261 |
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && |
|
4262 |
classCache( className, function( elem ) { |
|
4263 |
return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); |
|
4264 |
}); |
|
4265 |
}, |
|
4266 |
|
|
4267 |
"ATTR": function( name, operator, check ) { |
|
4268 |
return function( elem, context ) { |
|
4269 |
var result = Sizzle.attr( elem, name ); |
|
4270 |
|
|
4271 |
if ( result == null ) { |
|
4272 |
return operator === "!="; |
|
4273 |
} |
|
4274 |
if ( !operator ) { |
|
4275 |
return true; |
|
4276 |
} |
|
4277 |
|
|
4278 |
result += ""; |
|
4279 |
|
|
4280 |
return operator === "=" ? result === check : |
|
4281 |
operator === "!=" ? result !== check : |
|
4282 |
operator === "^=" ? check && result.indexOf( check ) === 0 : |
|
4283 |
operator === "*=" ? check && result.indexOf( check ) > -1 : |
|
4284 |
operator === "$=" ? check && result.substr( result.length - check.length ) === check : |
|
4285 |
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : |
|
4286 |
operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : |
|
4287 |
false; |
|
4288 |
}; |
|
4289 |
}, |
|
4290 |
|
|
4291 |
"CHILD": function( type, argument, first, last ) { |
|
4292 |
|
|
4293 |
if ( type === "nth" ) { |
|
4294 |
return function( elem ) { |
|
4295 |
var node, diff, |
|
4296 |
parent = elem.parentNode; |
|
4297 |
|
|
4298 |
if ( first === 1 && last === 0 ) { |
|
4299 |
return true; |
|
4300 |
} |
|
4301 |
|
|
4302 |
if ( parent ) { |
|
4303 |
diff = 0; |
|
4304 |
for ( node = parent.firstChild; node; node = node.nextSibling ) { |
|
4305 |
if ( node.nodeType === 1 ) { |
|
4306 |
diff++; |
|
4307 |
if ( elem === node ) { |
|
4308 |
break; |
|
4309 |
} |
|
4310 |
} |
|
4311 |
} |
|
4312 |
} |
|
4313 |
|
|
4314 |
// Incorporate the offset (or cast to NaN), then check against cycle size |
|
4315 |
diff -= last; |
|
4316 |
return diff === first || ( diff % first === 0 && diff / first >= 0 ); |
|
4317 |
}; |
|
4318 |
} |
|
4319 |
|
|
4320 |
return function( elem ) { |
|
4321 |
var node = elem; |
|
4322 |
|
|
4323 |
switch ( type ) { |
|
4324 |
case "only": |
|
4325 |
case "first": |
|
4326 |
while ( (node = node.previousSibling) ) { |
|
4327 |
if ( node.nodeType === 1 ) { |
|
4328 |
return false; |
|
4329 |
} |
|
4330 |
} |
|
4331 |
|
|
4332 |
if ( type === "first" ) { |
|
4333 |
return true; |
|
4334 |
} |
|
4335 |
|
|
4336 |
node = elem; |
|
4337 |
|
|
4338 |
/* falls through */ |
|
4339 |
case "last": |
|
4340 |
while ( (node = node.nextSibling) ) { |
|
4341 |
if ( node.nodeType === 1 ) { |
|
4342 |
return false; |
|
4343 |
} |
|
4344 |
} |
|
4345 |
|
|
4346 |
return true; |
|
4347 |
} |
|
4348 |
}; |
|
4349 |
}, |
|
4350 |
|
|
4351 |
"PSEUDO": function( pseudo, argument ) { |
|
4352 |
// pseudo-class names are case-insensitive |
|
4353 |
// http://www.w3.org/TR/selectors/#pseudo-classes |
|
4354 |
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
|
4355 |
// Remember that setFilters inherits from pseudos |
|
4356 |
var args, |
|
4357 |
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || |
|
4358 |
Sizzle.error( "unsupported pseudo: " + pseudo ); |
|
4359 |
|
|
4360 |
// The user may use createPseudo to indicate that |
|
4361 |
// arguments are needed to create the filter function |
|
4362 |
// just as Sizzle does |
|
4363 |
if ( fn[ expando ] ) { |
|
4364 |
return fn( argument ); |
|
4365 |
} |
|
4366 |
|
|
4367 |
// But maintain support for old signatures |
|
4368 |
if ( fn.length > 1 ) { |
|
4369 |
args = [ pseudo, pseudo, "", argument ]; |
|
4370 |
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? |
|
4371 |
markFunction(function( seed, matches ) { |
|
4372 |
var idx, |
|
4373 |
matched = fn( seed, argument ), |
|
4374 |
i = matched.length; |
|
4375 |
while ( i-- ) { |
|
4376 |
idx = indexOf.call( seed, matched[i] ); |
|
4377 |
seed[ idx ] = !( matches[ idx ] = matched[i] ); |
|
4378 |
} |
|
4379 |
}) : |
|
4380 |
function( elem ) { |
|
4381 |
return fn( elem, 0, args ); |
|
4382 |
}; |
|
4383 |
} |
|
4384 |
|
|
4385 |
return fn; |
|
4386 |
} |
|
4387 |
}, |
|
4388 |
|
|
4389 |
pseudos: { |
|
4390 |
"not": markFunction(function( selector ) { |
|
4391 |
// Trim the selector passed to compile |
|
4392 |
// to avoid treating leading and trailing |
|
4393 |
// spaces as combinators |
|
4394 |
var input = [], |
|
4395 |
results = [], |
|
4396 |
matcher = compile( selector.replace( rtrim, "$1" ) ); |
|
4397 |
|
|
4398 |
return matcher[ expando ] ? |
|
4399 |
markFunction(function( seed, matches, context, xml ) { |
|
4400 |
var elem, |
|
4401 |
unmatched = matcher( seed, null, xml, [] ), |
|
4402 |
i = seed.length; |
|
4403 |
|
|
4404 |
// Match elements unmatched by `matcher` |
|
4405 |
while ( i-- ) { |
|
4406 |
if ( (elem = unmatched[i]) ) { |
|
4407 |
seed[i] = !(matches[i] = elem); |
|
4408 |
} |
|
4409 |
} |
|
4410 |
}) : |
|
4411 |
function( elem, context, xml ) { |
|
4412 |
input[0] = elem; |
|
4413 |
matcher( input, null, xml, results ); |
|
4414 |
return !results.pop(); |
|
4415 |
}; |
|
4416 |
}), |
|
4417 |
|
|
4418 |
"has": markFunction(function( selector ) { |
|
4419 |
return function( elem ) { |
|
4420 |
return Sizzle( selector, elem ).length > 0; |
|
4421 |
}; |
|
4422 |
}), |
|
4423 |
|
|
4424 |
"contains": markFunction(function( text ) { |
|
4425 |
return function( elem ) { |
|
4426 |
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; |
|
4427 |
}; |
|
4428 |
}), |
|
4429 |
|
|
4430 |
"enabled": function( elem ) { |
|
4431 |
return elem.disabled === false; |
|
4432 |
}, |
|
4433 |
|
|
4434 |
"disabled": function( elem ) { |
|
4435 |
return elem.disabled === true; |
|
4436 |
}, |
|
4437 |
|
|
4438 |
"checked": function( elem ) { |
|
4439 |
// In CSS3, :checked should return both checked and selected elements |
|
4440 |
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
|
4441 |
var nodeName = elem.nodeName.toLowerCase(); |
|
4442 |
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); |
|
4443 |
}, |
|
4444 |
|
|
4445 |
"selected": function( elem ) { |
|
4446 |
// Accessing this property makes selected-by-default |
|
4447 |
// options in Safari work properly |
|
4448 |
if ( elem.parentNode ) { |
|
4449 |
elem.parentNode.selectedIndex; |
|
4450 |
} |
|
4451 |
|
|
4452 |
return elem.selected === true; |
|
4453 |
}, |
|
4454 |
|
|
4455 |
"parent": function( elem ) { |
|
4456 |
return !Expr.pseudos["empty"]( elem ); |
|
4457 |
}, |
|
4458 |
|
|
4459 |
"empty": function( elem ) { |
|
4460 |
// http://www.w3.org/TR/selectors/#empty-pseudo |
|
4461 |
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), |
|
4462 |
// not comment, processing instructions, or others |
|
4463 |
// Thanks to Diego Perini for the nodeName shortcut |
|
4464 |
// Greater than "@" means alpha characters (specifically not starting with "#" or "?") |
|
4465 |
var nodeType; |
|
4466 |
elem = elem.firstChild; |
|
4467 |
while ( elem ) { |
|
4468 |
if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) { |
|
4469 |
return false; |
|
4470 |
} |
|
4471 |
elem = elem.nextSibling; |
|
4472 |
} |
|
4473 |
return true; |
|
4474 |
}, |
|
4475 |
|
|
4476 |
"header": function( elem ) { |
|
4477 |
return rheader.test( elem.nodeName ); |
|
4478 |
}, |
|
4479 |
|
|
4480 |
"text": function( elem ) { |
|
4481 |
var type, attr; |
|
4482 |
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) |
|
4483 |
// use getAttribute instead to test this case |
|
4484 |
return elem.nodeName.toLowerCase() === "input" && |
|
4485 |
(type = elem.type) === "text" && |
|
4486 |
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); |
|
4487 |
}, |
|
4488 |
|
|
4489 |
// Input types |
|
4490 |
"radio": createInputPseudo("radio"), |
|
4491 |
"checkbox": createInputPseudo("checkbox"), |
|
4492 |
"file": createInputPseudo("file"), |
|
4493 |
"password": createInputPseudo("password"), |
|
4494 |
"image": createInputPseudo("image"), |
|
4495 |
|
|
4496 |
"submit": createButtonPseudo("submit"), |
|
4497 |
"reset": createButtonPseudo("reset"), |
|
4498 |
|
|
4499 |
"button": function( elem ) { |
|
4500 |
var name = elem.nodeName.toLowerCase(); |
|
4501 |
return name === "input" && elem.type === "button" || name === "button"; |
|
4502 |
}, |
|
4503 |
|
|
4504 |
"input": function( elem ) { |
|
4505 |
return rinputs.test( elem.nodeName ); |
|
4506 |
}, |
|
4507 |
|
|
4508 |
"focus": function( elem ) { |
|
4509 |
var doc = elem.ownerDocument; |
|
4510 |
return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); |
|
4511 |
}, |
|
4512 |
|
|
4513 |
"active": function( elem ) { |
|
4514 |
return elem === elem.ownerDocument.activeElement; |
|
4515 |
}, |
|
4516 |
|
|
4517 |
// Positional types |
|
4518 |
"first": createPositionalPseudo(function() { |
|
4519 |
return [ 0 ]; |
|
4520 |
}), |
|
4521 |
|
|
4522 |
"last": createPositionalPseudo(function( matchIndexes, length ) { |
|
4523 |
return [ length - 1 ]; |
|
4524 |
}), |
|
4525 |
|
|
4526 |
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) { |
|
4527 |
return [ argument < 0 ? argument + length : argument ]; |
|
4528 |
}), |
|
4529 |
|
|
4530 |
"even": createPositionalPseudo(function( matchIndexes, length ) { |
|
4531 |
for ( var i = 0; i < length; i += 2 ) { |
|
4532 |
matchIndexes.push( i ); |
|
4533 |
} |
|
4534 |
return matchIndexes; |
|
4535 |
}), |
|
4536 |
|
|
4537 |
"odd": createPositionalPseudo(function( matchIndexes, length ) { |
|
4538 |
for ( var i = 1; i < length; i += 2 ) { |
|
4539 |
matchIndexes.push( i ); |
|
4540 |
} |
|
4541 |
return matchIndexes; |
|
4542 |
}), |
|
4543 |
|
|
4544 |
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
|
4545 |
for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) { |
|
4546 |
matchIndexes.push( i ); |
|
4547 |
} |
|
4548 |
return matchIndexes; |
|
4549 |
}), |
|
4550 |
|
|
4551 |
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
|
4552 |
for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) { |
|
4553 |
matchIndexes.push( i ); |
|
4554 |
} |
|
4555 |
return matchIndexes; |
|
4556 |
}) |
|
4557 |
} |
|
4558 |
}; |
|
4559 |
|
|
4560 |
function siblingCheck( a, b, ret ) { |
|
4561 |
if ( a === b ) { |
|
4562 |
return ret; |
|
4563 |
} |
|
4564 |
|
|
4565 |
var cur = a.nextSibling; |
|
4566 |
|
|
4567 |
while ( cur ) { |
|
4568 |
if ( cur === b ) { |
|
4569 |
return -1; |
|
4570 |
} |
|
4571 |
|
|
4572 |
cur = cur.nextSibling; |
|
4573 |
} |
|
4574 |
|
|
4575 |
return 1; |
|
4576 |
} |
|
4577 |
|
|
4578 |
sortOrder = docElem.compareDocumentPosition ? |
|
4579 |
function( a, b ) { |
|
4580 |
if ( a === b ) { |
|
4581 |
hasDuplicate = true; |
|
4582 |
return 0; |
|
4583 |
} |
|
4584 |
|
|
4585 |
return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? |
|
4586 |
a.compareDocumentPosition : |
|
4587 |
a.compareDocumentPosition(b) & 4 |
|
4588 |
) ? -1 : 1; |
|
4589 |
} : |
|
4590 |
function( a, b ) { |
|
4591 |
// The nodes are identical, we can exit early |
|
4592 |
if ( a === b ) { |
|
4593 |
hasDuplicate = true; |
|
4594 |
return 0; |
|
4595 |
|
|
4596 |
// Fallback to using sourceIndex (in IE) if it's available on both nodes |
|
4597 |
} else if ( a.sourceIndex && b.sourceIndex ) { |
|
4598 |
return a.sourceIndex - b.sourceIndex; |
|
4599 |
} |
|
4600 |
|
|
4601 |
var al, bl, |
|
4602 |
ap = [], |
|
4603 |
bp = [], |
|
4604 |
aup = a.parentNode, |
|
4605 |
bup = b.parentNode, |
|
4606 |
cur = aup; |
|
4607 |
|
|
4608 |
// If the nodes are siblings (or identical) we can do a quick check |
|
4609 |
if ( aup === bup ) { |
|
4610 |
return siblingCheck( a, b ); |
|
4611 |
|
|
4612 |
// If no parents were found then the nodes are disconnected |
|
4613 |
} else if ( !aup ) { |
|
4614 |
return -1; |
|
4615 |
|
|
4616 |
} else if ( !bup ) { |
|
4617 |
return 1; |
|
4618 |
} |
|
4619 |
|
|
4620 |
// Otherwise they're somewhere else in the tree so we need |
|
4621 |
// to build up a full list of the parentNodes for comparison |
|
4622 |
while ( cur ) { |
|
4623 |
ap.unshift( cur ); |
|
4624 |
cur = cur.parentNode; |
|
4625 |
} |
|
4626 |
|
|
4627 |
cur = bup; |
|
4628 |
|
|
4629 |
while ( cur ) { |
|
4630 |
bp.unshift( cur ); |
|
4631 |
cur = cur.parentNode; |
|
4632 |
} |
|
4633 |
|
|
4634 |
al = ap.length; |
|
4635 |
bl = bp.length; |
|
4636 |
|
|
4637 |
// Start walking down the tree looking for a discrepancy |
|
4638 |
for ( var i = 0; i < al && i < bl; i++ ) { |
|
4639 |
if ( ap[i] !== bp[i] ) { |
|
4640 |
return siblingCheck( ap[i], bp[i] ); |
|
4641 |
} |
|
4642 |
} |
|
4643 |
|
|
4644 |
// We ended someplace up the tree so do a sibling check |
|
4645 |
return i === al ? |
|
4646 |
siblingCheck( a, bp[i], -1 ) : |
|
4647 |
siblingCheck( ap[i], b, 1 ); |
|
4648 |
}; |
|
4649 |
|
|
4650 |
// Always assume the presence of duplicates if sort doesn't |
|
4651 |
// pass them to our comparison function (as in Google Chrome). |
|
4652 |
[0, 0].sort( sortOrder ); |
|
4653 |
baseHasDuplicate = !hasDuplicate; |
|
4654 |
|
|
4655 |
// Document sorting and removing duplicates |
|
4656 |
Sizzle.uniqueSort = function( results ) { |
|
4657 |
var elem, |
|
4658 |
duplicates = [], |
|
4659 |
i = 1, |
|
4660 |
j = 0; |
|
4661 |
|
|
4662 |
hasDuplicate = baseHasDuplicate; |
|
4663 |
results.sort( sortOrder ); |
|
4664 |
|
|
4665 |
if ( hasDuplicate ) { |
|
4666 |
for ( ; (elem = results[i]); i++ ) { |
|
4667 |
if ( elem === results[ i - 1 ] ) { |
|
4668 |
j = duplicates.push( i ); |
|
4669 |
} |
|
4670 |
} |
|
4671 |
while ( j-- ) { |
|
4672 |
results.splice( duplicates[ j ], 1 ); |
|
4673 |
} |
|
4674 |
} |
|
4675 |
|
|
4676 |
return results; |
|
4677 |
}; |
|
4678 |
|
|
4679 |
Sizzle.error = function( msg ) { |
|
4680 |
throw new Error( "Syntax error, unrecognized expression: " + msg ); |
|
4681 |
}; |
|
4682 |
|
|
4683 |
function tokenize( selector, parseOnly ) { |
|
4684 |
var matched, match, tokens, type, |
|
4685 |
soFar, groups, preFilters, |
|
4686 |
cached = tokenCache[ expando ][ selector + " " ]; |
|
4687 |
|
|
4688 |
if ( cached ) { |
|
4689 |
return parseOnly ? 0 : cached.slice( 0 ); |
|
4690 |
} |
|
4691 |
|
|
4692 |
soFar = selector; |
|
4693 |
groups = []; |
|
4694 |
preFilters = Expr.preFilter; |
|
4695 |
|
|
4696 |
while ( soFar ) { |
|
4697 |
|
|
4698 |
// Comma and first run |
|
4699 |
if ( !matched || (match = rcomma.exec( soFar )) ) { |
|
4700 |
if ( match ) { |
|
4701 |
// Don't consume trailing commas as valid |
|
4702 |
soFar = soFar.slice( match[0].length ) || soFar; |
|
4703 |
} |
|
4704 |
groups.push( tokens = [] ); |
|
4705 |
} |
|
4706 |
|
|
4707 |
matched = false; |
|
4708 |
|
|
4709 |
// Combinators |
|
4710 |
if ( (match = rcombinators.exec( soFar )) ) { |
|
4711 |
tokens.push( matched = new Token( match.shift() ) ); |
|
4712 |
soFar = soFar.slice( matched.length ); |
|
4713 |
|
|
4714 |
// Cast descendant combinators to space |
|
4715 |
matched.type = match[0].replace( rtrim, " " ); |
|
4716 |
} |
|
4717 |
|
|
4718 |
// Filters |
|
4719 |
for ( type in Expr.filter ) { |
|
4720 |
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || |
|
4721 |
(match = preFilters[ type ]( match ))) ) { |
|
4722 |
|
|
4723 |
tokens.push( matched = new Token( match.shift() ) ); |
|
4724 |
soFar = soFar.slice( matched.length ); |
|
4725 |
matched.type = type; |
|
4726 |
matched.matches = match; |
|
4727 |
} |
|
4728 |
} |
|
4729 |
|
|
4730 |
if ( !matched ) { |
|
4731 |
break; |
|
4732 |
} |
|
4733 |
} |
|
4734 |
|
|
4735 |
// Return the length of the invalid excess |
|
4736 |
// if we're just parsing |
|
4737 |
// Otherwise, throw an error or return tokens |
|
4738 |
return parseOnly ? |
|
4739 |
soFar.length : |
|
4740 |
soFar ? |
|
4741 |
Sizzle.error( selector ) : |
|
4742 |
// Cache the tokens |
|
4743 |
tokenCache( selector, groups ).slice( 0 ); |
|
4744 |
} |
|
4745 |
|
|
4746 |
function addCombinator( matcher, combinator, base ) { |
|
4747 |
var dir = combinator.dir, |
|
4748 |
checkNonElements = base && combinator.dir === "parentNode", |
|
4749 |
doneName = done++; |
|
4750 |
|
|
4751 |
return combinator.first ? |
|
4752 |
// Check against closest ancestor/preceding element |
|
4753 |
function( elem, context, xml ) { |
|
4754 |
while ( (elem = elem[ dir ]) ) { |
|
4755 |
if ( checkNonElements || elem.nodeType === 1 ) { |
|
4756 |
return matcher( elem, context, xml ); |
|
4757 |
} |
|
4758 |
} |
|
4759 |
} : |
|
4760 |
|
|
4761 |
// Check against all ancestor/preceding elements |
|
4762 |
function( elem, context, xml ) { |
|
4763 |
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching |
|
4764 |
if ( !xml ) { |
|
4765 |
var cache, |
|
4766 |
dirkey = dirruns + " " + doneName + " ", |
|
4767 |
cachedkey = dirkey + cachedruns; |
|
4768 |
while ( (elem = elem[ dir ]) ) { |
|
4769 |
if ( checkNonElements || elem.nodeType === 1 ) { |
|
4770 |
if ( (cache = elem[ expando ]) === cachedkey ) { |
|
4771 |
return elem.sizset; |
|
4772 |
} else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) { |
|
4773 |
if ( elem.sizset ) { |
|
4774 |
return elem; |
Formats disponibles : Unified diff
Weekly update of contrib modules