jquery-source 1.8.2 → 1.8.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Jquery
2
2
  module Source
3
- VERSION = "1.8.2"
3
+ VERSION = "1.8.3"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
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,7 +9,7 @@
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,7 +186,7 @@ jQuery.fn = jQuery.prototype = {
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,8 +999,10 @@ jQuery.Callbacks = function( options ) {
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,24 +1255,23 @@ jQuery.support = (function() {
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,7 +1313,7 @@ jQuery.support = (function() {
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,26 +2218,25 @@ jQuery.extend({
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,11 +2251,6 @@ jQuery.extend({
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,7 +3228,7 @@ jQuery.removeEvent = document.removeEventListener ?
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;
@@ -3428,1904 +3423,1922 @@ if ( !jQuery.support.changeBubbles ) {
3428
3423
  }
3429
3424
  return false;
3430
3425
  }
3431
- // Delegated event; lazy-add a change handler on descendant inputs
3432
- jQuery.event.add( this, "beforeactivate._change", function( e ) {
3433
- var elem = e.target;
3434
-
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 );
3439
- }
3440
- });
3441
- jQuery._data( elem, "_change_attached", true );
3442
- }
3443
- });
3444
- },
3445
-
3446
- handle: function( event ) {
3447
- var elem = event.target;
3448
-
3449
- // Swallow native change events from checkbox/radio, we already triggered them above
3450
- if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
3451
- return event.handleObj.handler.apply( this, arguments );
3452
- }
3453
- },
3454
-
3455
- teardown: function() {
3456
- jQuery.event.remove( this, "._change" );
3457
-
3458
- return !rformElems.test( this.nodeName );
3459
- }
3460
- };
3461
- }
3462
-
3463
- // Create "bubbling" focus and blur events
3464
- if ( !jQuery.support.focusinBubbles ) {
3465
- jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
3466
-
3467
- // Attach a single capturing handler while someone wants focusin/focusout
3468
- var attaches = 0,
3469
- handler = function( event ) {
3470
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
3471
- };
3472
-
3473
- jQuery.event.special[ fix ] = {
3474
- setup: function() {
3475
- if ( attaches++ === 0 ) {
3476
- document.addEventListener( orig, handler, true );
3477
- }
3478
- },
3479
- teardown: function() {
3480
- if ( --attaches === 0 ) {
3481
- document.removeEventListener( orig, handler, true );
3482
- }
3483
- }
3484
- };
3485
- });
3486
- }
3487
-
3488
- jQuery.fn.extend({
3489
-
3490
- on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
3491
- var origFn, type;
3492
-
3493
- // Types can be a map of types/handlers
3494
- if ( typeof types === "object" ) {
3495
- // ( types-Object, selector, data )
3496
- if ( typeof selector !== "string" ) { // && selector != null
3497
- // ( types-Object, data )
3498
- data = data || selector;
3499
- selector = undefined;
3500
- }
3501
- for ( type in types ) {
3502
- this.on( type, selector, data, types[ type ], one );
3503
- }
3504
- return this;
3505
- }
3506
-
3507
- if ( data == null && fn == null ) {
3508
- // ( types, fn )
3509
- fn = selector;
3510
- data = selector = undefined;
3511
- } else if ( fn == null ) {
3512
- if ( typeof selector === "string" ) {
3513
- // ( types, selector, fn )
3514
- fn = data;
3515
- data = undefined;
3516
- } else {
3517
- // ( types, data, fn )
3518
- fn = data;
3519
- data = selector;
3520
- selector = undefined;
3521
- }
3522
- }
3523
- if ( fn === false ) {
3524
- fn = returnFalse;
3525
- } else if ( !fn ) {
3526
- return this;
3527
- }
3528
-
3529
- if ( one === 1 ) {
3530
- origFn = fn;
3531
- fn = function( event ) {
3532
- // Can use an empty set, since event contains the info
3533
- jQuery().off( event );
3534
- return origFn.apply( this, arguments );
3535
- };
3536
- // Use same guid so caller can remove using origFn
3537
- fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
3538
- }
3539
- return this.each( function() {
3540
- jQuery.event.add( this, types, fn, data, selector );
3541
- });
3542
- },
3543
- one: function( types, selector, data, fn ) {
3544
- return this.on( types, selector, data, fn, 1 );
3545
- },
3546
- off: function( types, selector, fn ) {
3547
- var handleObj, type;
3548
- if ( types && types.preventDefault && types.handleObj ) {
3549
- // ( event ) dispatched jQuery.Event
3550
- handleObj = types.handleObj;
3551
- jQuery( types.delegateTarget ).off(
3552
- handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
3553
- handleObj.selector,
3554
- handleObj.handler
3555
- );
3556
- return this;
3557
- }
3558
- if ( typeof types === "object" ) {
3559
- // ( types-object [, selector] )
3560
- for ( type in types ) {
3561
- this.off( type, selector, types[ type ] );
3562
- }
3563
- return this;
3564
- }
3565
- if ( selector === false || typeof selector === "function" ) {
3566
- // ( types [, fn] )
3567
- fn = selector;
3568
- selector = undefined;
3569
- }
3570
- if ( fn === false ) {
3571
- fn = returnFalse;
3572
- }
3573
- return this.each(function() {
3574
- jQuery.event.remove( this, types, fn, selector );
3575
- });
3576
- },
3577
-
3578
- bind: function( types, data, fn ) {
3579
- return this.on( types, null, data, fn );
3580
- },
3581
- unbind: function( types, fn ) {
3582
- return this.off( types, null, fn );
3583
- },
3584
-
3585
- live: function( types, data, fn ) {
3586
- jQuery( this.context ).on( types, this.selector, data, fn );
3587
- return this;
3588
- },
3589
- die: function( types, fn ) {
3590
- jQuery( this.context ).off( types, this.selector || "**", fn );
3591
- return this;
3592
- },
3593
-
3594
- delegate: function( selector, types, data, fn ) {
3595
- return this.on( types, selector, data, fn );
3596
- },
3597
- undelegate: function( selector, types, fn ) {
3598
- // ( namespace ) or ( selector, types [, fn] )
3599
- return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
3600
- },
3601
-
3602
- trigger: function( type, data ) {
3603
- return this.each(function() {
3604
- jQuery.event.trigger( type, data, this );
3605
- });
3606
- },
3607
- triggerHandler: function( type, data ) {
3608
- if ( this[0] ) {
3609
- return jQuery.event.trigger( type, data, this[0], true );
3610
- }
3611
- },
3612
-
3613
- toggle: function( fn ) {
3614
- // Save reference to arguments for access in closure
3615
- var args = arguments,
3616
- guid = fn.guid || jQuery.guid++,
3617
- i = 0,
3618
- toggler = function( event ) {
3619
- // Figure out which function to execute
3620
- var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
3621
- jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
3622
-
3623
- // Make sure that clicks stop
3624
- event.preventDefault();
3625
-
3626
- // and execute the function
3627
- return args[ lastToggle ].apply( this, arguments ) || false;
3628
- };
3629
-
3630
- // link all the functions, so any of them can unbind this click handler
3631
- toggler.guid = guid;
3632
- while ( i < args.length ) {
3633
- args[ i++ ].guid = guid;
3634
- }
3635
-
3636
- return this.click( toggler );
3637
- },
3638
-
3639
- hover: function( fnOver, fnOut ) {
3640
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
3641
- }
3642
- });
3643
-
3644
- jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
3645
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
3646
- "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
3647
-
3648
- // Handle event binding
3649
- jQuery.fn[ name ] = function( data, fn ) {
3650
- if ( fn == null ) {
3651
- fn = data;
3652
- data = null;
3653
- }
3654
-
3655
- return arguments.length > 0 ?
3656
- this.on( name, null, data, fn ) :
3657
- this.trigger( name );
3658
- };
3659
-
3660
- if ( rkeyEvent.test( name ) ) {
3661
- jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
3662
- }
3663
-
3664
- if ( rmouseEvent.test( name ) ) {
3665
- jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
3666
- }
3667
- });
3668
- /*!
3669
- * Sizzle CSS Selector Engine
3670
- * Copyright 2012 jQuery Foundation and other contributors
3671
- * Released under the MIT license
3672
- * http://sizzlejs.com/
3673
- */
3674
- (function( window, undefined ) {
3675
-
3676
- var cachedruns,
3677
- assertGetIdNotName,
3678
- Expr,
3679
- getText,
3680
- isXML,
3681
- contains,
3682
- compile,
3683
- sortOrder,
3684
- hasDuplicate,
3685
- outermostContext,
3686
-
3687
- baseHasDuplicate = true,
3688
- strundefined = "undefined",
3689
-
3690
- expando = ( "sizcache" + Math.random() ).replace( ".", "" ),
3691
-
3692
- Token = String,
3693
- document = window.document,
3694
- docElem = document.documentElement,
3695
- dirruns = 0,
3696
- done = 0,
3697
- pop = [].pop,
3698
- push = [].push,
3699
- slice = [].slice,
3700
- // Use a stripped-down indexOf if a native one is unavailable
3701
- indexOf = [].indexOf || function( elem ) {
3702
- var i = 0,
3703
- len = this.length;
3704
- for ( ; i < len; i++ ) {
3705
- if ( this[i] === elem ) {
3706
- return i;
3707
- }
3708
- }
3709
- return -1;
3710
- },
3711
-
3712
- // Augment a function for special use by Sizzle
3713
- markFunction = function( fn, value ) {
3714
- fn[ expando ] = value == null || value;
3715
- return fn;
3716
- },
3717
-
3718
- createCache = function() {
3719
- var cache = {},
3720
- keys = [];
3721
-
3722
- return markFunction(function( key, value ) {
3723
- // Only keep the most recent entries
3724
- if ( keys.push( key ) > Expr.cacheLength ) {
3725
- delete cache[ keys.shift() ];
3726
- }
3727
-
3728
- return (cache[ key ] = value);
3729
- }, cache );
3730
- },
3731
-
3732
- classCache = createCache(),
3733
- tokenCache = createCache(),
3734
- compilerCache = createCache(),
3735
-
3736
- // Regex
3737
-
3738
- // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
3739
- whitespace = "[\\x20\\t\\r\\n\\f]",
3740
- // http://www.w3.org/TR/css3-syntax/#characters
3741
- characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",
3742
-
3743
- // Loosely modeled on CSS identifier characters
3744
- // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)
3745
- // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
3746
- identifier = characterEncoding.replace( "w", "w#" ),
3747
-
3748
- // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
3749
- operators = "([*^$|!~]?=)",
3750
- attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
3751
- "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
3752
-
3753
- // Prefer arguments not in parens/brackets,
3754
- // then attribute selectors and non-pseudos (denoted by :),
3755
- // then anything else
3756
- // These preferences are here to reduce the number of selectors
3757
- // needing tokenize in the PSEUDO preFilter
3758
- pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)",
3759
-
3760
- // For matchExpr.POS and matchExpr.needsContext
3761
- pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
3762
- "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)",
3763
-
3764
- // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
3765
- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
3766
-
3767
- rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
3768
- rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
3769
- rpseudo = new RegExp( pseudos ),
3770
-
3771
- // Easily-parseable/retrievable ID or TAG or CLASS selectors
3772
- rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,
3773
-
3774
- rnot = /^:not/,
3775
- rsibling = /[\x20\t\r\n\f]*[+~]/,
3776
- rendsWithNot = /:not\($/,
3777
-
3778
- rheader = /h\d/i,
3779
- rinputs = /input|select|textarea|button/i,
3780
-
3781
- rbackslash = /\\(?!\\)/g,
3782
-
3783
- matchExpr = {
3784
- "ID": new RegExp( "^#(" + characterEncoding + ")" ),
3785
- "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
3786
- "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
3787
- "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
3788
- "ATTR": new RegExp( "^" + attributes ),
3789
- "PSEUDO": new RegExp( "^" + pseudos ),
3790
- "POS": new RegExp( pos, "i" ),
3791
- "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace +
3792
- "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
3793
- "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
3794
- // For use in libraries implementing .is()
3795
- "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" )
3796
- },
3797
-
3798
- // Support
3799
-
3800
- // Used for testing something on an element
3801
- assert = function( fn ) {
3802
- var div = document.createElement("div");
3803
-
3804
- try {
3805
- return fn( div );
3806
- } catch (e) {
3807
- return false;
3808
- } finally {
3809
- // release memory in IE
3810
- div = null;
3811
- }
3812
- },
3813
-
3814
- // Check if getElementsByTagName("*") returns only elements
3815
- assertTagNameNoComments = assert(function( div ) {
3816
- div.appendChild( document.createComment("") );
3817
- return !div.getElementsByTagName("*").length;
3818
- }),
3819
-
3820
- // Check if getAttribute returns normalized href attributes
3821
- assertHrefNotNormalized = assert(function( div ) {
3822
- div.innerHTML = "<a href='#'></a>";
3823
- return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
3824
- div.firstChild.getAttribute("href") === "#";
3825
- }),
3826
-
3827
- // Check if attributes should be retrieved by attribute nodes
3828
- assertAttributes = assert(function( div ) {
3829
- div.innerHTML = "<select></select>";
3830
- var type = typeof div.lastChild.getAttribute("multiple");
3831
- // IE8 returns a string for some attributes even when not present
3832
- return type !== "boolean" && type !== "string";
3833
- }),
3834
-
3835
- // Check if getElementsByClassName can be trusted
3836
- assertUsableClassName = assert(function( div ) {
3837
- // Opera can't find a second classname (in 9.6)
3838
- div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
3839
- if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
3840
- return false;
3841
- }
3842
-
3843
- // Safari 3.2 caches class attributes and doesn't catch changes
3844
- div.lastChild.className = "e";
3845
- return div.getElementsByClassName("e").length === 2;
3846
- }),
3847
-
3848
- // Check if getElementById returns elements by name
3849
- // Check if getElementsByName privileges form controls or returns elements by ID
3850
- assertUsableName = assert(function( div ) {
3851
- // Inject content
3852
- div.id = expando + 0;
3853
- div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
3854
- docElem.insertBefore( div, docElem.firstChild );
3855
-
3856
- // Test
3857
- var pass = document.getElementsByName &&
3858
- // buggy browsers will return fewer than the correct 2
3859
- document.getElementsByName( expando ).length === 2 +
3860
- // buggy browsers will return more than the correct 0
3861
- document.getElementsByName( expando + 0 ).length;
3862
- assertGetIdNotName = !document.getElementById( expando );
3863
-
3864
- // Cleanup
3865
- docElem.removeChild( div );
3866
-
3867
- return pass;
3868
- });
3869
-
3870
- // If slice is not available, provide a backup
3871
- try {
3872
- slice.call( docElem.childNodes, 0 )[0].nodeType;
3873
- } catch ( e ) {
3874
- slice = function( i ) {
3875
- var elem,
3876
- results = [];
3877
- for ( ; (elem = this[i]); i++ ) {
3878
- results.push( elem );
3879
- }
3880
- return results;
3881
- };
3882
- }
3883
-
3884
- function Sizzle( selector, context, results, seed ) {
3885
- results = results || [];
3886
- context = context || document;
3887
- var match, elem, xml, m,
3888
- nodeType = context.nodeType;
3889
-
3890
- if ( !selector || typeof selector !== "string" ) {
3891
- return results;
3892
- }
3893
-
3894
- if ( nodeType !== 1 && nodeType !== 9 ) {
3895
- return [];
3896
- }
3897
-
3898
- xml = isXML( context );
3899
-
3900
- if ( !xml && !seed ) {
3901
- if ( (match = rquickExpr.exec( selector )) ) {
3902
- // Speed-up: Sizzle("#ID")
3903
- if ( (m = match[1]) ) {
3904
- if ( nodeType === 9 ) {
3905
- elem = context.getElementById( m );
3906
- // Check parentNode to catch when Blackberry 4.6 returns
3907
- // nodes that are no longer in the document #6963
3908
- if ( elem && elem.parentNode ) {
3909
- // Handle the case where IE, Opera, and Webkit return items
3910
- // by name instead of ID
3911
- if ( elem.id === m ) {
3912
- results.push( elem );
3913
- return results;
3914
- }
3915
- } else {
3916
- return results;
3917
- }
3918
- } else {
3919
- // Context is not a document
3920
- if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
3921
- contains( context, elem ) && elem.id === m ) {
3922
- results.push( elem );
3923
- return results;
3924
- }
3925
- }
3926
-
3927
- // Speed-up: Sizzle("TAG")
3928
- } else if ( match[2] ) {
3929
- push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
3930
- return results;
3931
-
3932
- // Speed-up: Sizzle(".CLASS")
3933
- } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {
3934
- push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
3935
- return results;
3936
- }
3937
- }
3938
- }
3939
-
3940
- // All others
3941
- return select( selector.replace( rtrim, "$1" ), context, results, seed, xml );
3942
- }
3943
-
3944
- Sizzle.matches = function( expr, elements ) {
3945
- return Sizzle( expr, null, null, elements );
3946
- };
3947
-
3948
- Sizzle.matchesSelector = function( elem, expr ) {
3949
- return Sizzle( expr, null, null, [ elem ] ).length > 0;
3950
- };
3951
-
3952
- // Returns a function to use in pseudos for input types
3953
- function createInputPseudo( type ) {
3954
- return function( elem ) {
3955
- var name = elem.nodeName.toLowerCase();
3956
- return name === "input" && elem.type === type;
3957
- };
3958
- }
3959
-
3960
- // Returns a function to use in pseudos for buttons
3961
- function createButtonPseudo( type ) {
3962
- return function( elem ) {
3963
- var name = elem.nodeName.toLowerCase();
3964
- return (name === "input" || name === "button") && elem.type === type;
3965
- };
3966
- }
3967
-
3968
- // Returns a function to use in pseudos for positionals
3969
- function createPositionalPseudo( fn ) {
3970
- return markFunction(function( argument ) {
3971
- argument = +argument;
3972
- return markFunction(function( seed, matches ) {
3973
- var j,
3974
- matchIndexes = fn( [], seed.length, argument ),
3975
- i = matchIndexes.length;
3976
-
3977
- // Match elements found at the specified indexes
3978
- while ( i-- ) {
3979
- if ( seed[ (j = matchIndexes[i]) ] ) {
3980
- seed[j] = !(matches[j] = seed[j]);
3981
- }
3982
- }
3983
- });
3984
- });
3985
- }
3986
-
3987
- /**
3988
- * Utility function for retrieving the text value of an array of DOM nodes
3989
- * @param {Array|Element} elem
3990
- */
3991
- getText = Sizzle.getText = function( elem ) {
3992
- var node,
3993
- ret = "",
3994
- i = 0,
3995
- nodeType = elem.nodeType;
3996
-
3997
- if ( nodeType ) {
3998
- if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
3999
- // Use textContent for elements
4000
- // innerText usage removed for consistency of new lines (see #11153)
4001
- if ( typeof elem.textContent === "string" ) {
4002
- return elem.textContent;
4003
- } else {
4004
- // Traverse its children
4005
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
4006
- ret += getText( elem );
4007
- }
4008
- }
4009
- } else if ( nodeType === 3 || nodeType === 4 ) {
4010
- return elem.nodeValue;
4011
- }
4012
- // Do not include comment or processing instruction nodes
4013
- } else {
4014
-
4015
- // If no nodeType, this is expected to be an array
4016
- for ( ; (node = elem[i]); i++ ) {
4017
- // Do not traverse comment nodes
4018
- ret += getText( node );
4019
- }
4020
- }
4021
- return ret;
4022
- };
4023
-
4024
- isXML = Sizzle.isXML = function( elem ) {
4025
- // documentElement is verified for cases where it doesn't yet exist
4026
- // (such as loading iframes in IE - #4833)
4027
- var documentElement = elem && (elem.ownerDocument || elem).documentElement;
4028
- return documentElement ? documentElement.nodeName !== "HTML" : false;
4029
- };
4030
-
4031
- // Element contains another
4032
- contains = Sizzle.contains = docElem.contains ?
4033
- function( a, b ) {
4034
- var adown = a.nodeType === 9 ? a.documentElement : a,
4035
- bup = b && b.parentNode;
4036
- return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );
4037
- } :
4038
- docElem.compareDocumentPosition ?
4039
- function( a, b ) {
4040
- return b && !!( a.compareDocumentPosition( b ) & 16 );
4041
- } :
4042
- function( a, b ) {
4043
- while ( (b = b.parentNode) ) {
4044
- if ( b === a ) {
4045
- return true;
4046
- }
4047
- }
4048
- return false;
4049
- };
4050
-
4051
- Sizzle.attr = function( elem, name ) {
4052
- var val,
4053
- xml = isXML( elem );
4054
-
4055
- if ( !xml ) {
4056
- name = name.toLowerCase();
4057
- }
4058
- if ( (val = Expr.attrHandle[ name ]) ) {
4059
- return val( elem );
4060
- }
4061
- if ( xml || assertAttributes ) {
4062
- return elem.getAttribute( name );
4063
- }
4064
- val = elem.getAttributeNode( name );
4065
- return val ?
4066
- typeof elem[ name ] === "boolean" ?
4067
- elem[ name ] ? name : null :
4068
- val.specified ? val.value : null :
4069
- null;
4070
- };
4071
-
4072
- Expr = Sizzle.selectors = {
4073
-
4074
- // Can be adjusted by the user
4075
- cacheLength: 50,
4076
-
4077
- createPseudo: markFunction,
4078
-
4079
- match: matchExpr,
4080
-
4081
- // IE6/7 return a modified href
4082
- attrHandle: assertHrefNotNormalized ?
4083
- {} :
4084
- {
4085
- "href": function( elem ) {
4086
- return elem.getAttribute( "href", 2 );
4087
- },
4088
- "type": function( elem ) {
4089
- return elem.getAttribute("type");
4090
- }
4091
- },
4092
-
4093
- find: {
4094
- "ID": assertGetIdNotName ?
4095
- function( id, context, xml ) {
4096
- if ( typeof context.getElementById !== strundefined && !xml ) {
4097
- var m = context.getElementById( id );
4098
- // Check parentNode to catch when Blackberry 4.6 returns
4099
- // nodes that are no longer in the document #6963
4100
- return m && m.parentNode ? [m] : [];
4101
- }
4102
- } :
4103
- function( id, context, xml ) {
4104
- if ( typeof context.getElementById !== strundefined && !xml ) {
4105
- var m = context.getElementById( id );
4106
-
4107
- return m ?
4108
- m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
4109
- [m] :
4110
- undefined :
4111
- [];
4112
- }
4113
- },
4114
-
4115
- "TAG": assertTagNameNoComments ?
4116
- function( tag, context ) {
4117
- if ( typeof context.getElementsByTagName !== strundefined ) {
4118
- return context.getElementsByTagName( tag );
4119
- }
4120
- } :
4121
- function( tag, context ) {
4122
- var results = context.getElementsByTagName( tag );
4123
-
4124
- // Filter out possible comments
4125
- if ( tag === "*" ) {
4126
- var elem,
4127
- tmp = [],
4128
- i = 0;
4129
-
4130
- for ( ; (elem = results[i]); i++ ) {
4131
- if ( elem.nodeType === 1 ) {
4132
- tmp.push( elem );
4133
- }
4134
- }
4135
-
4136
- return tmp;
4137
- }
4138
- return results;
4139
- },
4140
-
4141
- "NAME": assertUsableName && function( tag, context ) {
4142
- if ( typeof context.getElementsByName !== strundefined ) {
4143
- return context.getElementsByName( name );
4144
- }
4145
- },
4146
-
4147
- "CLASS": assertUsableClassName && function( className, context, xml ) {
4148
- if ( typeof context.getElementsByClassName !== strundefined && !xml ) {
4149
- return context.getElementsByClassName( className );
4150
- }
4151
- }
4152
- },
4153
-
4154
- relative: {
4155
- ">": { dir: "parentNode", first: true },
4156
- " ": { dir: "parentNode" },
4157
- "+": { dir: "previousSibling", first: true },
4158
- "~": { dir: "previousSibling" }
4159
- },
4160
-
4161
- preFilter: {
4162
- "ATTR": function( match ) {
4163
- match[1] = match[1].replace( rbackslash, "" );
4164
-
4165
- // Move the given value to match[3] whether quoted or unquoted
4166
- match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );
4167
-
4168
- if ( match[2] === "~=" ) {
4169
- match[3] = " " + match[3] + " ";
4170
- }
4171
-
4172
- return match.slice( 0, 4 );
4173
- },
4174
-
4175
- "CHILD": function( match ) {
4176
- /* matches from matchExpr["CHILD"]
4177
- 1 type (only|nth|...)
4178
- 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4179
- 3 xn-component of xn+y argument ([+-]?\d*n|)
4180
- 4 sign of xn-component
4181
- 5 x of xn-component
4182
- 6 sign of y-component
4183
- 7 y of y-component
4184
- */
4185
- match[1] = match[1].toLowerCase();
4186
-
4187
- if ( match[1] === "nth" ) {
4188
- // nth-child requires argument
4189
- if ( !match[2] ) {
4190
- Sizzle.error( match[0] );
4191
- }
4192
-
4193
- // numeric x and y parameters for Expr.filter.CHILD
4194
- // remember that false/true cast respectively to 0/1
4195
- match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) );
4196
- match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" );
4197
-
4198
- // other types prohibit arguments
4199
- } else if ( match[2] ) {
4200
- Sizzle.error( match[0] );
4201
- }
4202
-
4203
- return match;
4204
- },
4205
-
4206
- "PSEUDO": function( match ) {
4207
- var unquoted, excess;
4208
- if ( matchExpr["CHILD"].test( match[0] ) ) {
4209
- return null;
4210
- }
4211
-
4212
- if ( match[3] ) {
4213
- match[2] = match[3];
4214
- } else if ( (unquoted = match[4]) ) {
4215
- // Only check arguments that contain a pseudo
4216
- if ( rpseudo.test(unquoted) &&
4217
- // Get excess from tokenize (recursively)
4218
- (excess = tokenize( unquoted, true )) &&
4219
- // advance to the next closing parenthesis
4220
- (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
4221
-
4222
- // excess is a negative index
4223
- unquoted = unquoted.slice( 0, excess );
4224
- match[0] = match[0].slice( 0, excess );
4225
- }
4226
- match[2] = unquoted;
4227
- }
4228
-
4229
- // Return only captures needed by the pseudo filter method (type and argument)
4230
- return match.slice( 0, 3 );
4231
- }
4232
- },
4233
-
4234
- filter: {
4235
- "ID": assertGetIdNotName ?
4236
- function( id ) {
4237
- id = id.replace( rbackslash, "" );
4238
- return function( elem ) {
4239
- return elem.getAttribute("id") === id;
4240
- };
4241
- } :
4242
- function( id ) {
4243
- id = id.replace( rbackslash, "" );
4244
- return function( elem ) {
4245
- var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
4246
- return node && node.value === id;
4247
- };
4248
- },
4249
-
4250
- "TAG": function( nodeName ) {
4251
- if ( nodeName === "*" ) {
4252
- return function() { return true; };
4253
- }
4254
- nodeName = nodeName.replace( rbackslash, "" ).toLowerCase();
4255
-
4256
- return function( elem ) {
4257
- return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
4258
- };
4259
- },
4260
-
4261
- "CLASS": function( className ) {
4262
- var pattern = classCache[ expando ][ className ];
4263
- if ( !pattern ) {
4264
- pattern = classCache( className, new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)") );
4265
- }
4266
- return function( elem ) {
4267
- return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
4268
- };
4269
- },
4270
-
4271
- "ATTR": function( name, operator, check ) {
4272
- return function( elem, context ) {
4273
- var result = Sizzle.attr( elem, name );
4274
-
4275
- if ( result == null ) {
4276
- return operator === "!=";
4277
- }
4278
- if ( !operator ) {
4279
- return true;
4280
- }
4281
-
4282
- result += "";
4283
-
4284
- return operator === "=" ? result === check :
4285
- operator === "!=" ? result !== check :
4286
- operator === "^=" ? check && result.indexOf( check ) === 0 :
4287
- operator === "*=" ? check && result.indexOf( check ) > -1 :
4288
- operator === "$=" ? check && result.substr( result.length - check.length ) === check :
4289
- operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
4290
- operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" :
4291
- false;
4292
- };
4293
- },
4294
-
4295
- "CHILD": function( type, argument, first, last ) {
4296
-
4297
- if ( type === "nth" ) {
4298
- return function( elem ) {
4299
- var node, diff,
4300
- parent = elem.parentNode;
4301
-
4302
- if ( first === 1 && last === 0 ) {
4303
- return true;
4304
- }
4305
-
4306
- if ( parent ) {
4307
- diff = 0;
4308
- for ( node = parent.firstChild; node; node = node.nextSibling ) {
4309
- if ( node.nodeType === 1 ) {
4310
- diff++;
4311
- if ( elem === node ) {
4312
- break;
4313
- }
4314
- }
4315
- }
4316
- }
4317
-
4318
- // Incorporate the offset (or cast to NaN), then check against cycle size
4319
- diff -= last;
4320
- return diff === first || ( diff % first === 0 && diff / first >= 0 );
4321
- };
4322
- }
4323
-
4324
- return function( elem ) {
4325
- var node = elem;
4326
-
4327
- switch ( type ) {
4328
- case "only":
4329
- case "first":
4330
- while ( (node = node.previousSibling) ) {
4331
- if ( node.nodeType === 1 ) {
4332
- return false;
4333
- }
4334
- }
4335
-
4336
- if ( type === "first" ) {
4337
- return true;
4338
- }
4339
-
4340
- node = elem;
4341
-
4342
- /* falls through */
4343
- case "last":
4344
- while ( (node = node.nextSibling) ) {
4345
- if ( node.nodeType === 1 ) {
4346
- return false;
4347
- }
4348
- }
4349
-
4350
- return true;
4351
- }
4352
- };
4353
- },
4354
-
4355
- "PSEUDO": function( pseudo, argument ) {
4356
- // pseudo-class names are case-insensitive
4357
- // http://www.w3.org/TR/selectors/#pseudo-classes
4358
- // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
4359
- // Remember that setFilters inherits from pseudos
4360
- var args,
4361
- fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
4362
- Sizzle.error( "unsupported pseudo: " + pseudo );
4363
-
4364
- // The user may use createPseudo to indicate that
4365
- // arguments are needed to create the filter function
4366
- // just as Sizzle does
4367
- if ( fn[ expando ] ) {
4368
- return fn( argument );
4369
- }
4370
-
4371
- // But maintain support for old signatures
4372
- if ( fn.length > 1 ) {
4373
- args = [ pseudo, pseudo, "", argument ];
4374
- return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
4375
- markFunction(function( seed, matches ) {
4376
- var idx,
4377
- matched = fn( seed, argument ),
4378
- i = matched.length;
4379
- while ( i-- ) {
4380
- idx = indexOf.call( seed, matched[i] );
4381
- seed[ idx ] = !( matches[ idx ] = matched[i] );
4382
- }
4383
- }) :
4384
- function( elem ) {
4385
- return fn( elem, 0, args );
4386
- };
4387
- }
4388
-
4389
- return fn;
4390
- }
4391
- },
4392
-
4393
- pseudos: {
4394
- "not": markFunction(function( selector ) {
4395
- // Trim the selector passed to compile
4396
- // to avoid treating leading and trailing
4397
- // spaces as combinators
4398
- var input = [],
4399
- results = [],
4400
- matcher = compile( selector.replace( rtrim, "$1" ) );
4401
-
4402
- return matcher[ expando ] ?
4403
- markFunction(function( seed, matches, context, xml ) {
4404
- var elem,
4405
- unmatched = matcher( seed, null, xml, [] ),
4406
- i = seed.length;
4407
-
4408
- // Match elements unmatched by `matcher`
4409
- while ( i-- ) {
4410
- if ( (elem = unmatched[i]) ) {
4411
- seed[i] = !(matches[i] = elem);
4412
- }
4413
- }
4414
- }) :
4415
- function( elem, context, xml ) {
4416
- input[0] = elem;
4417
- matcher( input, null, xml, results );
4418
- return !results.pop();
4419
- };
4420
- }),
4421
-
4422
- "has": markFunction(function( selector ) {
4423
- return function( elem ) {
4424
- return Sizzle( selector, elem ).length > 0;
4425
- };
4426
- }),
4427
-
4428
- "contains": markFunction(function( text ) {
4429
- return function( elem ) {
4430
- return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
4431
- };
4432
- }),
4433
-
4434
- "enabled": function( elem ) {
4435
- return elem.disabled === false;
4436
- },
4437
-
4438
- "disabled": function( elem ) {
4439
- return elem.disabled === true;
4440
- },
4441
-
4442
- "checked": function( elem ) {
4443
- // In CSS3, :checked should return both checked and selected elements
4444
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
4445
- var nodeName = elem.nodeName.toLowerCase();
4446
- return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
4447
- },
4448
-
4449
- "selected": function( elem ) {
4450
- // Accessing this property makes selected-by-default
4451
- // options in Safari work properly
4452
- if ( elem.parentNode ) {
4453
- elem.parentNode.selectedIndex;
4454
- }
4455
-
4456
- return elem.selected === true;
4457
- },
4458
-
4459
- "parent": function( elem ) {
4460
- return !Expr.pseudos["empty"]( elem );
4461
- },
4462
-
4463
- "empty": function( elem ) {
4464
- // http://www.w3.org/TR/selectors/#empty-pseudo
4465
- // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
4466
- // not comment, processing instructions, or others
4467
- // Thanks to Diego Perini for the nodeName shortcut
4468
- // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
4469
- var nodeType;
4470
- elem = elem.firstChild;
4471
- while ( elem ) {
4472
- if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {
4473
- return false;
4474
- }
4475
- elem = elem.nextSibling;
4476
- }
4477
- return true;
4478
- },
4479
-
4480
- "header": function( elem ) {
4481
- return rheader.test( elem.nodeName );
4482
- },
4483
-
4484
- "text": function( elem ) {
4485
- var type, attr;
4486
- // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
4487
- // use getAttribute instead to test this case
4488
- return elem.nodeName.toLowerCase() === "input" &&
4489
- (type = elem.type) === "text" &&
4490
- ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type );
4491
- },
4492
-
4493
- // Input types
4494
- "radio": createInputPseudo("radio"),
4495
- "checkbox": createInputPseudo("checkbox"),
4496
- "file": createInputPseudo("file"),
4497
- "password": createInputPseudo("password"),
4498
- "image": createInputPseudo("image"),
4499
-
4500
- "submit": createButtonPseudo("submit"),
4501
- "reset": createButtonPseudo("reset"),
4502
-
4503
- "button": function( elem ) {
4504
- var name = elem.nodeName.toLowerCase();
4505
- return name === "input" && elem.type === "button" || name === "button";
4506
- },
4507
-
4508
- "input": function( elem ) {
4509
- return rinputs.test( elem.nodeName );
4510
- },
4511
-
4512
- "focus": function( elem ) {
4513
- var doc = elem.ownerDocument;
4514
- return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href);
4515
- },
4516
-
4517
- "active": function( elem ) {
4518
- return elem === elem.ownerDocument.activeElement;
4519
- },
4520
-
4521
- // Positional types
4522
- "first": createPositionalPseudo(function( matchIndexes, length, argument ) {
4523
- return [ 0 ];
4524
- }),
4525
-
4526
- "last": createPositionalPseudo(function( matchIndexes, length, argument ) {
4527
- return [ length - 1 ];
4528
- }),
4529
-
4530
- "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
4531
- return [ argument < 0 ? argument + length : argument ];
4532
- }),
4533
-
4534
- "even": createPositionalPseudo(function( matchIndexes, length, argument ) {
4535
- for ( var i = 0; i < length; i += 2 ) {
4536
- matchIndexes.push( i );
4537
- }
4538
- return matchIndexes;
4539
- }),
4540
-
4541
- "odd": createPositionalPseudo(function( matchIndexes, length, argument ) {
4542
- for ( var i = 1; i < length; i += 2 ) {
4543
- matchIndexes.push( i );
4544
- }
4545
- return matchIndexes;
4546
- }),
4547
-
4548
- "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
4549
- for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) {
4550
- matchIndexes.push( i );
4551
- }
4552
- return matchIndexes;
4553
- }),
4554
-
4555
- "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
4556
- for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) {
4557
- matchIndexes.push( i );
4558
- }
4559
- return matchIndexes;
4560
- })
4561
- }
4562
- };
4563
-
4564
- function siblingCheck( a, b, ret ) {
4565
- if ( a === b ) {
4566
- return ret;
4567
- }
4568
-
4569
- var cur = a.nextSibling;
4570
-
4571
- while ( cur ) {
4572
- if ( cur === b ) {
4573
- return -1;
4574
- }
4575
-
4576
- cur = cur.nextSibling;
4577
- }
4578
-
4579
- return 1;
4580
- }
4581
-
4582
- sortOrder = docElem.compareDocumentPosition ?
4583
- function( a, b ) {
4584
- if ( a === b ) {
4585
- hasDuplicate = true;
4586
- return 0;
4587
- }
4588
-
4589
- return ( !a.compareDocumentPosition || !b.compareDocumentPosition ?
4590
- a.compareDocumentPosition :
4591
- a.compareDocumentPosition(b) & 4
4592
- ) ? -1 : 1;
4593
- } :
4594
- function( a, b ) {
4595
- // The nodes are identical, we can exit early
4596
- if ( a === b ) {
4597
- hasDuplicate = true;
4598
- return 0;
4599
-
4600
- // Fallback to using sourceIndex (in IE) if it's available on both nodes
4601
- } else if ( a.sourceIndex && b.sourceIndex ) {
4602
- return a.sourceIndex - b.sourceIndex;
4603
- }
4604
-
4605
- var al, bl,
4606
- ap = [],
4607
- bp = [],
4608
- aup = a.parentNode,
4609
- bup = b.parentNode,
4610
- cur = aup;
4611
-
4612
- // If the nodes are siblings (or identical) we can do a quick check
4613
- if ( aup === bup ) {
4614
- return siblingCheck( a, b );
4615
-
4616
- // If no parents were found then the nodes are disconnected
4617
- } else if ( !aup ) {
4618
- return -1;
4619
-
4620
- } else if ( !bup ) {
4621
- return 1;
4622
- }
4623
-
4624
- // Otherwise they're somewhere else in the tree so we need
4625
- // to build up a full list of the parentNodes for comparison
4626
- while ( cur ) {
4627
- ap.unshift( cur );
4628
- cur = cur.parentNode;
4629
- }
4630
-
4631
- cur = bup;
4632
-
4633
- while ( cur ) {
4634
- bp.unshift( cur );
4635
- cur = cur.parentNode;
4636
- }
4637
-
4638
- al = ap.length;
4639
- bl = bp.length;
4640
-
4641
- // Start walking down the tree looking for a discrepancy
4642
- for ( var i = 0; i < al && i < bl; i++ ) {
4643
- if ( ap[i] !== bp[i] ) {
4644
- return siblingCheck( ap[i], bp[i] );
4645
- }
4646
- }
4647
-
4648
- // We ended someplace up the tree so do a sibling check
4649
- return i === al ?
4650
- siblingCheck( a, bp[i], -1 ) :
4651
- siblingCheck( ap[i], b, 1 );
4652
- };
4653
-
4654
- // Always assume the presence of duplicates if sort doesn't
4655
- // pass them to our comparison function (as in Google Chrome).
4656
- [0, 0].sort( sortOrder );
4657
- baseHasDuplicate = !hasDuplicate;
4658
-
4659
- // Document sorting and removing duplicates
4660
- Sizzle.uniqueSort = function( results ) {
4661
- var elem,
4662
- i = 1;
4663
-
4664
- hasDuplicate = baseHasDuplicate;
4665
- results.sort( sortOrder );
4666
-
4667
- if ( hasDuplicate ) {
4668
- for ( ; (elem = results[i]); i++ ) {
4669
- if ( elem === results[ i - 1 ] ) {
4670
- results.splice( i--, 1 );
4671
- }
4672
- }
4673
- }
4674
-
4675
- return results;
4676
- };
4677
-
4678
- Sizzle.error = function( msg ) {
4679
- throw new Error( "Syntax error, unrecognized expression: " + msg );
4680
- };
4681
-
4682
- function tokenize( selector, parseOnly ) {
4683
- var matched, match, tokens, type, soFar, groups, preFilters,
4684
- cached = tokenCache[ expando ][ selector ];
4685
-
4686
- if ( cached ) {
4687
- return parseOnly ? 0 : cached.slice( 0 );
4688
- }
4689
-
4690
- soFar = selector;
4691
- groups = [];
4692
- preFilters = Expr.preFilter;
4693
-
4694
- while ( soFar ) {
4695
-
4696
- // Comma and first run
4697
- if ( !matched || (match = rcomma.exec( soFar )) ) {
4698
- if ( match ) {
4699
- soFar = soFar.slice( match[0].length );
4700
- }
4701
- groups.push( tokens = [] );
4702
- }
4703
-
4704
- matched = false;
4705
-
4706
- // Combinators
4707
- if ( (match = rcombinators.exec( soFar )) ) {
4708
- tokens.push( matched = new Token( match.shift() ) );
4709
- soFar = soFar.slice( matched.length );
4710
-
4711
- // Cast descendant combinators to space
4712
- matched.type = match[0].replace( rtrim, " " );
4713
- }
4714
-
4715
- // Filters
4716
- for ( type in Expr.filter ) {
4717
- if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
4718
- // The last two arguments here are (context, xml) for backCompat
4719
- (match = preFilters[ type ]( match, document, true ))) ) {
4720
-
4721
- tokens.push( matched = new Token( match.shift() ) );
4722
- soFar = soFar.slice( matched.length );
4723
- matched.type = type;
4724
- matched.matches = match;
4725
- }
4726
- }
4727
-
4728
- if ( !matched ) {
4729
- break;
4730
- }
4731
- }
4732
-
4733
- // Return the length of the invalid excess
4734
- // if we're just parsing
4735
- // Otherwise, throw an error or return tokens
4736
- return parseOnly ?
4737
- soFar.length :
4738
- soFar ?
4739
- Sizzle.error( selector ) :
4740
- // Cache the tokens
4741
- tokenCache( selector, groups ).slice( 0 );
4742
- }
4743
-
4744
- function addCombinator( matcher, combinator, base ) {
4745
- var dir = combinator.dir,
4746
- checkNonElements = base && combinator.dir === "parentNode",
4747
- doneName = done++;
4748
-
4749
- return combinator.first ?
4750
- // Check against closest ancestor/preceding element
4751
- function( elem, context, xml ) {
4752
- while ( (elem = elem[ dir ]) ) {
4753
- if ( checkNonElements || elem.nodeType === 1 ) {
4754
- return matcher( elem, context, xml );
4755
- }
4756
- }
4757
- } :
4758
-
4759
- // Check against all ancestor/preceding elements
4760
- function( elem, context, xml ) {
4761
- // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
4762
- if ( !xml ) {
4763
- var cache,
4764
- dirkey = dirruns + " " + doneName + " ",
4765
- cachedkey = dirkey + cachedruns;
4766
- while ( (elem = elem[ dir ]) ) {
4767
- if ( checkNonElements || elem.nodeType === 1 ) {
4768
- if ( (cache = elem[ expando ]) === cachedkey ) {
4769
- return elem.sizset;
4770
- } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) {
4771
- if ( elem.sizset ) {
4772
- return elem;
4773
- }
4774
- } else {
4775
- elem[ expando ] = cachedkey;
4776
- if ( matcher( elem, context, xml ) ) {
4777
- elem.sizset = true;
4778
- return elem;
4779
- }
4780
- elem.sizset = false;
4781
- }
4782
- }
4783
- }
4784
- } else {
4785
- while ( (elem = elem[ dir ]) ) {
4786
- if ( checkNonElements || elem.nodeType === 1 ) {
4787
- if ( matcher( elem, context, xml ) ) {
4788
- return elem;
4789
- }
4790
- }
4791
- }
4792
- }
4793
- };
4794
- }
4795
-
4796
- function elementMatcher( matchers ) {
4797
- return matchers.length > 1 ?
4798
- function( elem, context, xml ) {
4799
- var i = matchers.length;
4800
- while ( i-- ) {
4801
- if ( !matchers[i]( elem, context, xml ) ) {
4802
- return false;
4803
- }
4804
- }
4805
- return true;
4806
- } :
4807
- matchers[0];
4808
- }
4809
-
4810
- function condense( unmatched, map, filter, context, xml ) {
4811
- var elem,
4812
- newUnmatched = [],
4813
- i = 0,
4814
- len = unmatched.length,
4815
- mapped = map != null;
4816
-
4817
- for ( ; i < len; i++ ) {
4818
- if ( (elem = unmatched[i]) ) {
4819
- if ( !filter || filter( elem, context, xml ) ) {
4820
- newUnmatched.push( elem );
4821
- if ( mapped ) {
4822
- map.push( i );
4823
- }
4824
- }
4825
- }
4826
- }
4827
-
4828
- return newUnmatched;
4829
- }
4830
-
4831
- function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
4832
- if ( postFilter && !postFilter[ expando ] ) {
4833
- postFilter = setMatcher( postFilter );
4834
- }
4835
- if ( postFinder && !postFinder[ expando ] ) {
4836
- postFinder = setMatcher( postFinder, postSelector );
4837
- }
4838
- return markFunction(function( seed, results, context, xml ) {
4839
- // Positional selectors apply to seed elements, so it is invalid to follow them with relative ones
4840
- if ( seed && postFinder ) {
4841
- return;
4842
- }
4843
-
4844
- var i, elem, postFilterIn,
4845
- preMap = [],
4846
- postMap = [],
4847
- preexisting = results.length,
4848
-
4849
- // Get initial elements from seed or context
4850
- elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [], seed ),
4851
-
4852
- // Prefilter to get matcher input, preserving a map for seed-results synchronization
4853
- matcherIn = preFilter && ( seed || !selector ) ?
4854
- condense( elems, preMap, preFilter, context, xml ) :
4855
- elems,
4856
-
4857
- matcherOut = matcher ?
4858
- // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
4859
- postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
4860
-
4861
- // ...intermediate processing is necessary
4862
- [] :
4863
-
4864
- // ...otherwise use results directly
4865
- results :
4866
- matcherIn;
4867
-
4868
- // Find primary matches
4869
- if ( matcher ) {
4870
- matcher( matcherIn, matcherOut, context, xml );
4871
- }
4872
-
4873
- // Apply postFilter
4874
- if ( postFilter ) {
4875
- postFilterIn = condense( matcherOut, postMap );
4876
- postFilter( postFilterIn, [], context, xml );
4877
-
4878
- // Un-match failing elements by moving them back to matcherIn
4879
- i = postFilterIn.length;
4880
- while ( i-- ) {
4881
- if ( (elem = postFilterIn[i]) ) {
4882
- matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
4883
- }
4884
- }
4885
- }
4886
-
4887
- // Keep seed and results synchronized
4888
- if ( seed ) {
4889
- // Ignore postFinder because it can't coexist with seed
4890
- i = preFilter && matcherOut.length;
4891
- while ( i-- ) {
4892
- if ( (elem = matcherOut[i]) ) {
4893
- seed[ preMap[i] ] = !(results[ preMap[i] ] = elem);
4894
- }
4895
- }
4896
- } else {
4897
- matcherOut = condense(
4898
- matcherOut === results ?
4899
- matcherOut.splice( preexisting, matcherOut.length ) :
4900
- matcherOut
4901
- );
4902
- if ( postFinder ) {
4903
- postFinder( null, results, matcherOut, xml );
4904
- } else {
4905
- push.apply( results, matcherOut );
4906
- }
4907
- }
4908
- });
4909
- }
4910
-
4911
- function matcherFromTokens( tokens ) {
4912
- var checkContext, matcher, j,
4913
- len = tokens.length,
4914
- leadingRelative = Expr.relative[ tokens[0].type ],
4915
- implicitRelative = leadingRelative || Expr.relative[" "],
4916
- i = leadingRelative ? 1 : 0,
4917
-
4918
- // The foundational matcher ensures that elements are reachable from top-level context(s)
4919
- matchContext = addCombinator( function( elem ) {
4920
- return elem === checkContext;
4921
- }, implicitRelative, true ),
4922
- matchAnyContext = addCombinator( function( elem ) {
4923
- return indexOf.call( checkContext, elem ) > -1;
4924
- }, implicitRelative, true ),
4925
- matchers = [ function( elem, context, xml ) {
4926
- return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
4927
- (checkContext = context).nodeType ?
4928
- matchContext( elem, context, xml ) :
4929
- matchAnyContext( elem, context, xml ) );
4930
- } ];
4931
-
4932
- for ( ; i < len; i++ ) {
4933
- if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
4934
- matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
4935
- } else {
4936
- // The concatenated values are (context, xml) for backCompat
4937
- matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
4938
-
4939
- // Return special upon seeing a positional matcher
4940
- if ( matcher[ expando ] ) {
4941
- // Find the next relative operator (if any) for proper handling
4942
- j = ++i;
4943
- for ( ; j < len; j++ ) {
4944
- if ( Expr.relative[ tokens[j].type ] ) {
4945
- break;
4946
- }
4947
- }
4948
- return setMatcher(
4949
- i > 1 && elementMatcher( matchers ),
4950
- i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ),
4951
- matcher,
4952
- i < j && matcherFromTokens( tokens.slice( i, j ) ),
4953
- j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
4954
- j < len && tokens.join("")
4955
- );
4956
- }
4957
- matchers.push( matcher );
4958
- }
4959
- }
4960
-
4961
- return elementMatcher( matchers );
4962
- }
4963
-
4964
- function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
4965
- var bySet = setMatchers.length > 0,
4966
- byElement = elementMatchers.length > 0,
4967
- superMatcher = function( seed, context, xml, results, expandContext ) {
4968
- var elem, j, matcher,
4969
- setMatched = [],
4970
- matchedCount = 0,
4971
- i = "0",
4972
- unmatched = seed && [],
4973
- outermost = expandContext != null,
4974
- contextBackup = outermostContext,
4975
- // We must always have either seed elements or context
4976
- elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
4977
- // Nested matchers should use non-integer dirruns
4978
- dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);
4979
-
4980
- if ( outermost ) {
4981
- outermostContext = context !== document && context;
4982
- cachedruns = superMatcher.el;
4983
- }
4984
-
4985
- // Add elements passing elementMatchers directly to results
4986
- for ( ; (elem = elems[i]) != null; i++ ) {
4987
- if ( byElement && elem ) {
4988
- for ( j = 0; (matcher = elementMatchers[j]); j++ ) {
4989
- if ( matcher( elem, context, xml ) ) {
4990
- results.push( elem );
4991
- break;
4992
- }
4993
- }
4994
- if ( outermost ) {
4995
- dirruns = dirrunsUnique;
4996
- cachedruns = ++superMatcher.el;
4997
- }
4998
- }
4999
-
5000
- // Track unmatched elements for set filters
5001
- if ( bySet ) {
5002
- // They will have gone through all possible matchers
5003
- if ( (elem = !matcher && elem) ) {
5004
- matchedCount--;
5005
- }
5006
-
5007
- // Lengthen the array for every element, matched or not
5008
- if ( seed ) {
5009
- unmatched.push( elem );
5010
- }
5011
- }
5012
- }
5013
-
5014
- // Apply set filters to unmatched elements
5015
- matchedCount += i;
5016
- if ( bySet && i !== matchedCount ) {
5017
- for ( j = 0; (matcher = setMatchers[j]); j++ ) {
5018
- matcher( unmatched, setMatched, context, xml );
5019
- }
3426
+ // Delegated event; lazy-add a change handler on descendant inputs
3427
+ jQuery.event.add( this, "beforeactivate._change", function( e ) {
3428
+ var elem = e.target;
5020
3429
 
5021
- if ( seed ) {
5022
- // Reintegrate element matches to eliminate the need for sorting
5023
- if ( matchedCount > 0 ) {
5024
- while ( i-- ) {
5025
- if ( !(unmatched[i] || setMatched[i]) ) {
5026
- setMatched[i] = pop.call( results );
5027
- }
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 );
5028
3434
  }
5029
- }
5030
-
5031
- // Discard index placeholder values to get only actual matches
5032
- setMatched = condense( setMatched );
3435
+ });
3436
+ jQuery._data( elem, "_change_attached", true );
5033
3437
  }
3438
+ });
3439
+ },
5034
3440
 
5035
- // Add matches to results
5036
- push.apply( results, setMatched );
5037
-
5038
- // Seedless set matches succeeding multiple successful matchers stipulate sorting
5039
- if ( outermost && !seed && setMatched.length > 0 &&
5040
- ( matchedCount + setMatchers.length ) > 1 ) {
5041
-
5042
- Sizzle.uniqueSort( results );
5043
- }
5044
- }
3441
+ handle: function( event ) {
3442
+ var elem = event.target;
5045
3443
 
5046
- // Override manipulation of globals by nested matchers
5047
- if ( outermost ) {
5048
- dirruns = dirrunsUnique;
5049
- outermostContext = contextBackup;
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 );
5050
3447
  }
3448
+ },
5051
3449
 
5052
- return unmatched;
5053
- };
5054
-
5055
- superMatcher.el = 0;
5056
- return bySet ?
5057
- markFunction( superMatcher ) :
5058
- superMatcher;
5059
- }
3450
+ teardown: function() {
3451
+ jQuery.event.remove( this, "._change" );
5060
3452
 
5061
- compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
5062
- var i,
5063
- setMatchers = [],
5064
- elementMatchers = [],
5065
- cached = compilerCache[ expando ][ selector ];
5066
-
5067
- if ( !cached ) {
5068
- // Generate a function of recursive functions that can be used to check each element
5069
- if ( !group ) {
5070
- group = tokenize( selector );
5071
- }
5072
- i = group.length;
5073
- while ( i-- ) {
5074
- cached = matcherFromTokens( group[i] );
5075
- if ( cached[ expando ] ) {
5076
- setMatchers.push( cached );
5077
- } else {
5078
- elementMatchers.push( cached );
5079
- }
3453
+ return !rformElems.test( this.nodeName );
5080
3454
  }
5081
-
5082
- // Cache the compiled function
5083
- cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
5084
- }
5085
- return cached;
5086
- };
5087
-
5088
- function multipleContexts( selector, contexts, results, seed ) {
5089
- var i = 0,
5090
- len = contexts.length;
5091
- for ( ; i < len; i++ ) {
5092
- Sizzle( selector, contexts[i], results, seed );
5093
- }
5094
- return results;
3455
+ };
5095
3456
  }
5096
3457
 
5097
- function select( selector, context, results, seed, xml ) {
5098
- var i, tokens, token, type, find,
5099
- match = tokenize( selector ),
5100
- j = match.length;
5101
-
5102
- if ( !seed ) {
5103
- // Try to minimize operations if there is only one group
5104
- if ( match.length === 1 ) {
3458
+ // Create "bubbling" focus and blur events
3459
+ if ( !jQuery.support.focusinBubbles ) {
3460
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
5105
3461
 
5106
- // Take a shortcut and set the context if the root selector is an ID
5107
- tokens = match[0] = match[0].slice( 0 );
5108
- if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
5109
- context.nodeType === 9 && !xml &&
5110
- Expr.relative[ tokens[1].type ] ) {
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
+ };
5111
3467
 
5112
- context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0];
5113
- if ( !context ) {
5114
- return results;
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 );
5115
3477
  }
5116
-
5117
- selector = selector.slice( tokens.shift().length );
5118
3478
  }
3479
+ };
3480
+ });
3481
+ }
5119
3482
 
5120
- // Fetch a seed set for right-to-left matching
5121
- for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) {
5122
- token = tokens[i];
3483
+ jQuery.fn.extend({
5123
3484
 
5124
- // Abort if we hit a combinator
5125
- if ( Expr.relative[ (type = token.type) ] ) {
5126
- break;
5127
- }
5128
- if ( (find = Expr.find[ type ]) ) {
5129
- // Search, expanding context for leading sibling combinators
5130
- if ( (seed = find(
5131
- token.matches[0].replace( rbackslash, "" ),
5132
- rsibling.test( tokens[0].type ) && context.parentNode || context,
5133
- xml
5134
- )) ) {
5135
-
5136
- // If seed is empty or no tokens remain, we can return early
5137
- tokens.splice( i, 1 );
5138
- selector = seed.length && tokens.join("");
5139
- if ( !selector ) {
5140
- push.apply( results, slice.call( seed, 0 ) );
5141
- return results;
5142
- }
3485
+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
3486
+ var origFn, type;
5143
3487
 
5144
- break;
5145
- }
5146
- }
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;
5147
3495
  }
3496
+ for ( type in types ) {
3497
+ this.on( type, selector, data, types[ type ], one );
3498
+ }
3499
+ return this;
5148
3500
  }
5149
- }
5150
3501
 
5151
- // Compile and execute a filtering function
5152
- // Provide `match` to avoid retokenization if we modified the selector above
5153
- compile( selector, match )(
5154
- seed,
5155
- context,
5156
- xml,
5157
- results,
5158
- rsibling.test( selector )
5159
- );
5160
- return results;
5161
- }
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
+ }
5162
3523
 
5163
- if ( document.querySelectorAll ) {
5164
- (function() {
5165
- var disconnectedMatch,
5166
- oldSelect = select,
5167
- rescape = /'|\\/g,
5168
- rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
5169
-
5170
- // qSa(:focus) reports false when true (Chrome 21),
5171
- // A support test would require too much code (would include document ready)
5172
- rbuggyQSA = [":focus"],
5173
-
5174
- // matchesSelector(:focus) reports false when true (Chrome 21),
5175
- // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
5176
- // A support test would require too much code (would include document ready)
5177
- // just skip matchesSelector for :active
5178
- rbuggyMatches = [ ":active", ":focus" ],
5179
- matches = docElem.matchesSelector ||
5180
- docElem.mozMatchesSelector ||
5181
- docElem.webkitMatchesSelector ||
5182
- docElem.oMatchesSelector ||
5183
- docElem.msMatchesSelector;
5184
-
5185
- // Build QSA regex
5186
- // Regex strategy adopted from Diego Perini
5187
- assert(function( div ) {
5188
- // Select is set to empty string on purpose
5189
- // This is to test IE's treatment of not explictly
5190
- // setting a boolean content attribute,
5191
- // since its presence should be enough
5192
- // http://bugs.jquery.com/ticket/12359
5193
- div.innerHTML = "<select><option selected=''></option></select>";
5194
-
5195
- // IE8 - Some boolean attributes are not treated correctly
5196
- if ( !div.querySelectorAll("[selected]").length ) {
5197
- rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
5198
- }
5199
-
5200
- // Webkit/Opera - :checked should return selected option elements
5201
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
5202
- // IE8 throws error here (do not put tests after this one)
5203
- if ( !div.querySelectorAll(":checked").length ) {
5204
- rbuggyQSA.push(":checked");
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 ] );
5205
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 );
5206
3570
  });
3571
+ },
5207
3572
 
5208
- assert(function( div ) {
5209
-
5210
- // Opera 10-12/IE9 - ^= $= *= and empty values
5211
- // Should not select anything
5212
- div.innerHTML = "<p test=''></p>";
5213
- if ( div.querySelectorAll("[test^='']").length ) {
5214
- rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
5215
- }
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
+ },
5216
3579
 
5217
- // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
5218
- // IE8 throws error here (do not put tests after this one)
5219
- div.innerHTML = "<input type='hidden'/>";
5220
- if ( !div.querySelectorAll(":enabled").length ) {
5221
- rbuggyQSA.push(":enabled", ":disabled");
5222
- }
5223
- });
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
+ },
5224
3588
 
5225
- // rbuggyQSA always contains :focus, so no need for a length check
5226
- rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") );
5227
-
5228
- select = function( selector, context, results, seed, xml ) {
5229
- // Only use querySelectorAll when not filtering,
5230
- // when this is not xml,
5231
- // and when no QSA bugs apply
5232
- if ( !seed && !xml && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
5233
- var groups, i,
5234
- old = true,
5235
- nid = expando,
5236
- newContext = context,
5237
- newSelector = context.nodeType === 9 && selector;
5238
-
5239
- // qSA works strangely on Element-rooted queries
5240
- // We can work around this by specifying an extra ID on the root
5241
- // and working up from there (Thanks to Andrew Dupont for the technique)
5242
- // IE 8 doesn't work on object elements
5243
- if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
5244
- groups = tokenize( selector );
5245
-
5246
- if ( (old = context.getAttribute("id")) ) {
5247
- nid = old.replace( rescape, "\\$&" );
5248
- } else {
5249
- context.setAttribute( "id", nid );
5250
- }
5251
- nid = "[id='" + nid + "'] ";
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
+ },
5252
3596
 
5253
- i = groups.length;
5254
- while ( i-- ) {
5255
- groups[i] = nid + groups[i].join("");
5256
- }
5257
- newContext = rsibling.test( selector ) && context.parentNode || context;
5258
- newSelector = groups.join(",");
5259
- }
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
+ },
5260
3607
 
5261
- if ( newSelector ) {
5262
- try {
5263
- push.apply( results, slice.call( newContext.querySelectorAll(
5264
- newSelector
5265
- ), 0 ) );
5266
- return results;
5267
- } catch(qsaError) {
5268
- } finally {
5269
- if ( !old ) {
5270
- context.removeAttribute("id");
5271
- }
5272
- }
5273
- }
5274
- }
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 );
5275
3617
 
5276
- return oldSelect( selector, context, results, seed, xml );
5277
- };
3618
+ // Make sure that clicks stop
3619
+ event.preventDefault();
5278
3620
 
5279
- if ( matches ) {
5280
- assert(function( div ) {
5281
- // Check to see if it's possible to do matchesSelector
5282
- // on a disconnected node (IE 9)
5283
- disconnectedMatch = matches.call( div, "div" );
3621
+ // and execute the function
3622
+ return args[ lastToggle ].apply( this, arguments ) || false;
3623
+ };
5284
3624
 
5285
- // This should fail with an exception
5286
- // Gecko does not error, returns false instead
5287
- try {
5288
- matches.call( div, "[test!='']:sizzle" );
5289
- rbuggyMatches.push( "!=", pseudos );
5290
- } catch ( e ) {}
5291
- });
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
+ }
5292
3630
 
5293
- // rbuggyMatches always contains :active and :focus, so no need for a length check
5294
- rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );
3631
+ return this.click( toggler );
3632
+ },
5295
3633
 
5296
- Sizzle.matchesSelector = function( elem, expr ) {
5297
- // Make sure that attribute selectors are quoted
5298
- expr = expr.replace( rattributeQuotes, "='$1']" );
3634
+ hover: function( fnOver, fnOut ) {
3635
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
3636
+ }
3637
+ });
5299
3638
 
5300
- // rbuggyMatches always contains :active, so no need for an existence check
5301
- if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && (!rbuggyQSA || !rbuggyQSA.test( expr )) ) {
5302
- try {
5303
- var ret = matches.call( elem, expr );
5304
-
5305
- // IE 9's matchesSelector returns false on disconnected nodes
5306
- if ( ret || disconnectedMatch ||
5307
- // As well, disconnected nodes are said to be in a document
5308
- // fragment in IE 9
5309
- elem.document && elem.document.nodeType !== 11 ) {
5310
- return ret;
5311
- }
5312
- } catch(e) {}
5313
- }
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 ) {
5314
3642
 
5315
- return Sizzle( expr, null, null, [ elem ] ).length > 0;
5316
- };
3643
+ // Handle event binding
3644
+ jQuery.fn[ name ] = function( data, fn ) {
3645
+ if ( fn == null ) {
3646
+ fn = data;
3647
+ data = null;
5317
3648
  }
5318
- })();
5319
- }
5320
3649
 
5321
- // Deprecated
5322
- Expr.pseudos["nth"] = Expr.pseudos["eq"];
3650
+ return arguments.length > 0 ?
3651
+ this.on( name, null, data, fn ) :
3652
+ this.trigger( name );
3653
+ };
5323
3654
 
5324
- // Back-compat
5325
- function setFilters() {}
5326
- Expr.filters = setFilters.prototype = Expr.pseudos;
5327
- Expr.setFilters = new setFilters();
3655
+ if ( rkeyEvent.test( name ) ) {
3656
+ jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
3657
+ }
5328
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;
4775
+ }
4776
+ } else {
4777
+ elem[ expando ] = cachedkey;
4778
+ if ( matcher( elem, context, xml ) ) {
4779
+ elem.sizset = true;
4780
+ return elem;
4781
+ }
4782
+ elem.sizset = false;
4783
+ }
4784
+ }
4785
+ }
4786
+ } else {
4787
+ while ( (elem = elem[ dir ]) ) {
4788
+ if ( checkNonElements || elem.nodeType === 1 ) {
4789
+ if ( matcher( elem, context, xml ) ) {
4790
+ return elem;
4791
+ }
4792
+ }
4793
+ }
4794
+ }
4795
+ };
4796
+ }
4797
+
4798
+ function elementMatcher( matchers ) {
4799
+ return matchers.length > 1 ?
4800
+ function( elem, context, xml ) {
4801
+ var i = matchers.length;
4802
+ while ( i-- ) {
4803
+ if ( !matchers[i]( elem, context, xml ) ) {
4804
+ return false;
4805
+ }
4806
+ }
4807
+ return true;
4808
+ } :
4809
+ matchers[0];
4810
+ }
4811
+
4812
+ function condense( unmatched, map, filter, context, xml ) {
4813
+ var elem,
4814
+ newUnmatched = [],
4815
+ i = 0,
4816
+ len = unmatched.length,
4817
+ mapped = map != null;
4818
+
4819
+ for ( ; i < len; i++ ) {
4820
+ if ( (elem = unmatched[i]) ) {
4821
+ if ( !filter || filter( elem, context, xml ) ) {
4822
+ newUnmatched.push( elem );
4823
+ if ( mapped ) {
4824
+ map.push( i );
4825
+ }
4826
+ }
4827
+ }
4828
+ }
4829
+
4830
+ return newUnmatched;
4831
+ }
4832
+
4833
+ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
4834
+ if ( postFilter && !postFilter[ expando ] ) {
4835
+ postFilter = setMatcher( postFilter );
4836
+ }
4837
+ if ( postFinder && !postFinder[ expando ] ) {
4838
+ postFinder = setMatcher( postFinder, postSelector );
4839
+ }
4840
+ return markFunction(function( seed, results, context, xml ) {
4841
+ var temp, i, elem,
4842
+ preMap = [],
4843
+ postMap = [],
4844
+ preexisting = results.length,
4845
+
4846
+ // Get initial elements from seed or context
4847
+ elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
4848
+
4849
+ // Prefilter to get matcher input, preserving a map for seed-results synchronization
4850
+ matcherIn = preFilter && ( seed || !selector ) ?
4851
+ condense( elems, preMap, preFilter, context, xml ) :
4852
+ elems,
4853
+
4854
+ matcherOut = matcher ?
4855
+ // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
4856
+ postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
4857
+
4858
+ // ...intermediate processing is necessary
4859
+ [] :
4860
+
4861
+ // ...otherwise use results directly
4862
+ results :
4863
+ matcherIn;
4864
+
4865
+ // Find primary matches
4866
+ if ( matcher ) {
4867
+ matcher( matcherIn, matcherOut, context, xml );
4868
+ }
4869
+
4870
+ // Apply postFilter
4871
+ if ( postFilter ) {
4872
+ temp = condense( matcherOut, postMap );
4873
+ postFilter( temp, [], context, xml );
4874
+
4875
+ // Un-match failing elements by moving them back to matcherIn
4876
+ i = temp.length;
4877
+ while ( i-- ) {
4878
+ if ( (elem = temp[i]) ) {
4879
+ matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
4880
+ }
4881
+ }
4882
+ }
4883
+
4884
+ if ( seed ) {
4885
+ if ( postFinder || preFilter ) {
4886
+ if ( postFinder ) {
4887
+ // Get the final matcherOut by condensing this intermediate into postFinder contexts
4888
+ temp = [];
4889
+ i = matcherOut.length;
4890
+ while ( i-- ) {
4891
+ if ( (elem = matcherOut[i]) ) {
4892
+ // Restore matcherIn since elem is not yet a final match
4893
+ temp.push( (matcherIn[i] = elem) );
4894
+ }
4895
+ }
4896
+ postFinder( null, (matcherOut = []), temp, xml );
4897
+ }
4898
+
4899
+ // Move matched elements from seed to results to keep them synchronized
4900
+ i = matcherOut.length;
4901
+ while ( i-- ) {
4902
+ if ( (elem = matcherOut[i]) &&
4903
+ (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
4904
+
4905
+ seed[temp] = !(results[temp] = elem);
4906
+ }
4907
+ }
4908
+ }
4909
+
4910
+ // Add elements to results, through postFinder if defined
4911
+ } else {
4912
+ matcherOut = condense(
4913
+ matcherOut === results ?
4914
+ matcherOut.splice( preexisting, matcherOut.length ) :
4915
+ matcherOut
4916
+ );
4917
+ if ( postFinder ) {
4918
+ postFinder( null, results, matcherOut, xml );
4919
+ } else {
4920
+ push.apply( results, matcherOut );
4921
+ }
4922
+ }
4923
+ });
4924
+ }
4925
+
4926
+ function matcherFromTokens( tokens ) {
4927
+ var checkContext, matcher, j,
4928
+ len = tokens.length,
4929
+ leadingRelative = Expr.relative[ tokens[0].type ],
4930
+ implicitRelative = leadingRelative || Expr.relative[" "],
4931
+ i = leadingRelative ? 1 : 0,
4932
+
4933
+ // The foundational matcher ensures that elements are reachable from top-level context(s)
4934
+ matchContext = addCombinator( function( elem ) {
4935
+ return elem === checkContext;
4936
+ }, implicitRelative, true ),
4937
+ matchAnyContext = addCombinator( function( elem ) {
4938
+ return indexOf.call( checkContext, elem ) > -1;
4939
+ }, implicitRelative, true ),
4940
+ matchers = [ function( elem, context, xml ) {
4941
+ return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
4942
+ (checkContext = context).nodeType ?
4943
+ matchContext( elem, context, xml ) :
4944
+ matchAnyContext( elem, context, xml ) );
4945
+ } ];
4946
+
4947
+ for ( ; i < len; i++ ) {
4948
+ if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
4949
+ matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
4950
+ } else {
4951
+ matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
4952
+
4953
+ // Return special upon seeing a positional matcher
4954
+ if ( matcher[ expando ] ) {
4955
+ // Find the next relative operator (if any) for proper handling
4956
+ j = ++i;
4957
+ for ( ; j < len; j++ ) {
4958
+ if ( Expr.relative[ tokens[j].type ] ) {
4959
+ break;
4960
+ }
4961
+ }
4962
+ return setMatcher(
4963
+ i > 1 && elementMatcher( matchers ),
4964
+ i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ),
4965
+ matcher,
4966
+ i < j && matcherFromTokens( tokens.slice( i, j ) ),
4967
+ j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
4968
+ j < len && tokens.join("")
4969
+ );
4970
+ }
4971
+ matchers.push( matcher );
4972
+ }
4973
+ }
4974
+
4975
+ return elementMatcher( matchers );
4976
+ }
4977
+
4978
+ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
4979
+ var bySet = setMatchers.length > 0,
4980
+ byElement = elementMatchers.length > 0,
4981
+ superMatcher = function( seed, context, xml, results, expandContext ) {
4982
+ var elem, j, matcher,
4983
+ setMatched = [],
4984
+ matchedCount = 0,
4985
+ i = "0",
4986
+ unmatched = seed && [],
4987
+ outermost = expandContext != null,
4988
+ contextBackup = outermostContext,
4989
+ // We must always have either seed elements or context
4990
+ elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
4991
+ // Nested matchers should use non-integer dirruns
4992
+ dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);
4993
+
4994
+ if ( outermost ) {
4995
+ outermostContext = context !== document && context;
4996
+ cachedruns = superMatcher.el;
4997
+ }
4998
+
4999
+ // Add elements passing elementMatchers directly to results
5000
+ for ( ; (elem = elems[i]) != null; i++ ) {
5001
+ if ( byElement && elem ) {
5002
+ for ( j = 0; (matcher = elementMatchers[j]); j++ ) {
5003
+ if ( matcher( elem, context, xml ) ) {
5004
+ results.push( elem );
5005
+ break;
5006
+ }
5007
+ }
5008
+ if ( outermost ) {
5009
+ dirruns = dirrunsUnique;
5010
+ cachedruns = ++superMatcher.el;
5011
+ }
5012
+ }
5013
+
5014
+ // Track unmatched elements for set filters
5015
+ if ( bySet ) {
5016
+ // They will have gone through all possible matchers
5017
+ if ( (elem = !matcher && elem) ) {
5018
+ matchedCount--;
5019
+ }
5020
+
5021
+ // Lengthen the array for every element, matched or not
5022
+ if ( seed ) {
5023
+ unmatched.push( elem );
5024
+ }
5025
+ }
5026
+ }
5027
+
5028
+ // Apply set filters to unmatched elements
5029
+ matchedCount += i;
5030
+ if ( bySet && i !== matchedCount ) {
5031
+ for ( j = 0; (matcher = setMatchers[j]); j++ ) {
5032
+ matcher( unmatched, setMatched, context, xml );
5033
+ }
5034
+
5035
+ if ( seed ) {
5036
+ // Reintegrate element matches to eliminate the need for sorting
5037
+ if ( matchedCount > 0 ) {
5038
+ while ( i-- ) {
5039
+ if ( !(unmatched[i] || setMatched[i]) ) {
5040
+ setMatched[i] = pop.call( results );
5041
+ }
5042
+ }
5043
+ }
5044
+
5045
+ // Discard index placeholder values to get only actual matches
5046
+ setMatched = condense( setMatched );
5047
+ }
5048
+
5049
+ // Add matches to results
5050
+ push.apply( results, setMatched );
5051
+
5052
+ // Seedless set matches succeeding multiple successful matchers stipulate sorting
5053
+ if ( outermost && !seed && setMatched.length > 0 &&
5054
+ ( matchedCount + setMatchers.length ) > 1 ) {
5055
+
5056
+ Sizzle.uniqueSort( results );
5057
+ }
5058
+ }
5059
+
5060
+ // Override manipulation of globals by nested matchers
5061
+ if ( outermost ) {
5062
+ dirruns = dirrunsUnique;
5063
+ outermostContext = contextBackup;
5064
+ }
5065
+
5066
+ return unmatched;
5067
+ };
5068
+
5069
+ superMatcher.el = 0;
5070
+ return bySet ?
5071
+ markFunction( superMatcher ) :
5072
+ superMatcher;
5073
+ }
5074
+
5075
+ compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
5076
+ var i,
5077
+ setMatchers = [],
5078
+ elementMatchers = [],
5079
+ cached = compilerCache[ expando ][ selector + " " ];
5080
+
5081
+ if ( !cached ) {
5082
+ // Generate a function of recursive functions that can be used to check each element
5083
+ if ( !group ) {
5084
+ group = tokenize( selector );
5085
+ }
5086
+ i = group.length;
5087
+ while ( i-- ) {
5088
+ cached = matcherFromTokens( group[i] );
5089
+ if ( cached[ expando ] ) {
5090
+ setMatchers.push( cached );
5091
+ } else {
5092
+ elementMatchers.push( cached );
5093
+ }
5094
+ }
5095
+
5096
+ // Cache the compiled function
5097
+ cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
5098
+ }
5099
+ return cached;
5100
+ };
5101
+
5102
+ function multipleContexts( selector, contexts, results ) {
5103
+ var i = 0,
5104
+ len = contexts.length;
5105
+ for ( ; i < len; i++ ) {
5106
+ Sizzle( selector, contexts[i], results );
5107
+ }
5108
+ return results;
5109
+ }
5110
+
5111
+ function select( selector, context, results, seed, xml ) {
5112
+ var i, tokens, token, type, find,
5113
+ match = tokenize( selector ),
5114
+ j = match.length;
5115
+
5116
+ if ( !seed ) {
5117
+ // Try to minimize operations if there is only one group
5118
+ if ( match.length === 1 ) {
5119
+
5120
+ // Take a shortcut and set the context if the root selector is an ID
5121
+ tokens = match[0] = match[0].slice( 0 );
5122
+ if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
5123
+ context.nodeType === 9 && !xml &&
5124
+ Expr.relative[ tokens[1].type ] ) {
5125
+
5126
+ context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0];
5127
+ if ( !context ) {
5128
+ return results;
5129
+ }
5130
+
5131
+ selector = selector.slice( tokens.shift().length );
5132
+ }
5133
+
5134
+ // Fetch a seed set for right-to-left matching
5135
+ for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) {
5136
+ token = tokens[i];
5137
+
5138
+ // Abort if we hit a combinator
5139
+ if ( Expr.relative[ (type = token.type) ] ) {
5140
+ break;
5141
+ }
5142
+ if ( (find = Expr.find[ type ]) ) {
5143
+ // Search, expanding context for leading sibling combinators
5144
+ if ( (seed = find(
5145
+ token.matches[0].replace( rbackslash, "" ),
5146
+ rsibling.test( tokens[0].type ) && context.parentNode || context,
5147
+ xml
5148
+ )) ) {
5149
+
5150
+ // If seed is empty or no tokens remain, we can return early
5151
+ tokens.splice( i, 1 );
5152
+ selector = seed.length && tokens.join("");
5153
+ if ( !selector ) {
5154
+ push.apply( results, slice.call( seed, 0 ) );
5155
+ return results;
5156
+ }
5157
+
5158
+ break;
5159
+ }
5160
+ }
5161
+ }
5162
+ }
5163
+ }
5164
+
5165
+ // Compile and execute a filtering function
5166
+ // Provide `match` to avoid retokenization if we modified the selector above
5167
+ compile( selector, match )(
5168
+ seed,
5169
+ context,
5170
+ xml,
5171
+ results,
5172
+ rsibling.test( selector )
5173
+ );
5174
+ return results;
5175
+ }
5176
+
5177
+ if ( document.querySelectorAll ) {
5178
+ (function() {
5179
+ var disconnectedMatch,
5180
+ oldSelect = select,
5181
+ rescape = /'|\\/g,
5182
+ rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
5183
+
5184
+ // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA
5185
+ // A support test would require too much code (would include document ready)
5186
+ rbuggyQSA = [ ":focus" ],
5187
+
5188
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
5189
+ // A support test would require too much code (would include document ready)
5190
+ // just skip matchesSelector for :active
5191
+ rbuggyMatches = [ ":active" ],
5192
+ matches = docElem.matchesSelector ||
5193
+ docElem.mozMatchesSelector ||
5194
+ docElem.webkitMatchesSelector ||
5195
+ docElem.oMatchesSelector ||
5196
+ docElem.msMatchesSelector;
5197
+
5198
+ // Build QSA regex
5199
+ // Regex strategy adopted from Diego Perini
5200
+ assert(function( div ) {
5201
+ // Select is set to empty string on purpose
5202
+ // This is to test IE's treatment of not explictly
5203
+ // setting a boolean content attribute,
5204
+ // since its presence should be enough
5205
+ // http://bugs.jquery.com/ticket/12359
5206
+ div.innerHTML = "<select><option selected=''></option></select>";
5207
+
5208
+ // IE8 - Some boolean attributes are not treated correctly
5209
+ if ( !div.querySelectorAll("[selected]").length ) {
5210
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
5211
+ }
5212
+
5213
+ // Webkit/Opera - :checked should return selected option elements
5214
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
5215
+ // IE8 throws error here (do not put tests after this one)
5216
+ if ( !div.querySelectorAll(":checked").length ) {
5217
+ rbuggyQSA.push(":checked");
5218
+ }
5219
+ });
5220
+
5221
+ assert(function( div ) {
5222
+
5223
+ // Opera 10-12/IE9 - ^= $= *= and empty values
5224
+ // Should not select anything
5225
+ div.innerHTML = "<p test=''></p>";
5226
+ if ( div.querySelectorAll("[test^='']").length ) {
5227
+ rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
5228
+ }
5229
+
5230
+ // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
5231
+ // IE8 throws error here (do not put tests after this one)
5232
+ div.innerHTML = "<input type='hidden'/>";
5233
+ if ( !div.querySelectorAll(":enabled").length ) {
5234
+ rbuggyQSA.push(":enabled", ":disabled");
5235
+ }
5236
+ });
5237
+
5238
+ // rbuggyQSA always contains :focus, so no need for a length check
5239
+ rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") );
5240
+
5241
+ select = function( selector, context, results, seed, xml ) {
5242
+ // Only use querySelectorAll when not filtering,
5243
+ // when this is not xml,
5244
+ // and when no QSA bugs apply
5245
+ if ( !seed && !xml && !rbuggyQSA.test( selector ) ) {
5246
+ var groups, i,
5247
+ old = true,
5248
+ nid = expando,
5249
+ newContext = context,
5250
+ newSelector = context.nodeType === 9 && selector;
5251
+
5252
+ // qSA works strangely on Element-rooted queries
5253
+ // We can work around this by specifying an extra ID on the root
5254
+ // and working up from there (Thanks to Andrew Dupont for the technique)
5255
+ // IE 8 doesn't work on object elements
5256
+ if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
5257
+ groups = tokenize( selector );
5258
+
5259
+ if ( (old = context.getAttribute("id")) ) {
5260
+ nid = old.replace( rescape, "\\$&" );
5261
+ } else {
5262
+ context.setAttribute( "id", nid );
5263
+ }
5264
+ nid = "[id='" + nid + "'] ";
5265
+
5266
+ i = groups.length;
5267
+ while ( i-- ) {
5268
+ groups[i] = nid + groups[i].join("");
5269
+ }
5270
+ newContext = rsibling.test( selector ) && context.parentNode || context;
5271
+ newSelector = groups.join(",");
5272
+ }
5273
+
5274
+ if ( newSelector ) {
5275
+ try {
5276
+ push.apply( results, slice.call( newContext.querySelectorAll(
5277
+ newSelector
5278
+ ), 0 ) );
5279
+ return results;
5280
+ } catch(qsaError) {
5281
+ } finally {
5282
+ if ( !old ) {
5283
+ context.removeAttribute("id");
5284
+ }
5285
+ }
5286
+ }
5287
+ }
5288
+
5289
+ return oldSelect( selector, context, results, seed, xml );
5290
+ };
5291
+
5292
+ if ( matches ) {
5293
+ assert(function( div ) {
5294
+ // Check to see if it's possible to do matchesSelector
5295
+ // on a disconnected node (IE 9)
5296
+ disconnectedMatch = matches.call( div, "div" );
5297
+
5298
+ // This should fail with an exception
5299
+ // Gecko does not error, returns false instead
5300
+ try {
5301
+ matches.call( div, "[test!='']:sizzle" );
5302
+ rbuggyMatches.push( "!=", pseudos );
5303
+ } catch ( e ) {}
5304
+ });
5305
+
5306
+ // rbuggyMatches always contains :active and :focus, so no need for a length check
5307
+ rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );
5308
+
5309
+ Sizzle.matchesSelector = function( elem, expr ) {
5310
+ // Make sure that attribute selectors are quoted
5311
+ expr = expr.replace( rattributeQuotes, "='$1']" );
5312
+
5313
+ // rbuggyMatches always contains :active, so no need for an existence check
5314
+ if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) {
5315
+ try {
5316
+ var ret = matches.call( elem, expr );
5317
+
5318
+ // IE 9's matchesSelector returns false on disconnected nodes
5319
+ if ( ret || disconnectedMatch ||
5320
+ // As well, disconnected nodes are said to be in a document
5321
+ // fragment in IE 9
5322
+ elem.document && elem.document.nodeType !== 11 ) {
5323
+ return ret;
5324
+ }
5325
+ } catch(e) {}
5326
+ }
5327
+
5328
+ return Sizzle( expr, null, null, [ elem ] ).length > 0;
5329
+ };
5330
+ }
5331
+ })();
5332
+ }
5333
+
5334
+ // Deprecated
5335
+ Expr.pseudos["nth"] = Expr.pseudos["eq"];
5336
+
5337
+ // Back-compat
5338
+ function setFilters() {}
5339
+ Expr.filters = setFilters.prototype = Expr.pseudos;
5340
+ Expr.setFilters = new setFilters();
5341
+
5329
5342
  // Override sizzle attribute retrieval
5330
5343
  Sizzle.attr = jQuery.attr;
5331
5344
  jQuery.find = Sizzle;
@@ -5335,9 +5348,9 @@ jQuery.unique = Sizzle.uniqueSort;
5335
5348
  jQuery.text = Sizzle.getText;
5336
5349
  jQuery.isXMLDoc = Sizzle.isXML;
5337
5350
  jQuery.contains = Sizzle.contains;
5338
-
5339
-
5340
- })( window );
5351
+
5352
+
5353
+ })( window );
5341
5354
  var runtil = /Until$/,
5342
5355
  rparentsprev = /^(?:parents|prev(?:Until|All))/,
5343
5356
  isSimple = /^.[^:#\[\.,]*$/,
@@ -6533,7 +6546,7 @@ var curCSS, iframe, iframeDoc,
6533
6546
  rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
6534
6547
  rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
6535
6548
  rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ),
6536
- elemdisplay = {},
6549
+ elemdisplay = { BODY: "block" },
6537
6550
 
6538
6551
  cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6539
6552
  cssNormalTransform = {
@@ -6814,7 +6827,9 @@ if ( window.getComputedStyle ) {
6814
6827
 
6815
6828
  if ( computed ) {
6816
6829
 
6817
- ret = computed[ name ];
6830
+ // getPropertyValue is only needed for .css('filter') in IE9, see #12537
6831
+ ret = computed.getPropertyValue( name ) || computed[ name ];
6832
+
6818
6833
  if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
6819
6834
  ret = jQuery.style( elem, name );
6820
6835
  }
@@ -7843,9 +7858,12 @@ jQuery.extend({
7843
7858
 
7844
7859
  // A cross-domain request is in order when we have a protocol:host:port mismatch
7845
7860
  if ( s.crossDomain == null ) {
7846
- parts = rurl.exec( s.url.toLowerCase() ) || false;
7847
- s.crossDomain = parts && ( parts.join(":") + ( parts[ 3 ] ? "" : parts[ 1 ] === "http:" ? 80 : 443 ) ) !==
7848
- ( ajaxLocParts.join(":") + ( ajaxLocParts[ 3 ] ? "" : ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) );
7861
+ parts = rurl.exec( s.url.toLowerCase() );
7862
+ s.crossDomain = !!( parts &&
7863
+ ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
7864
+ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
7865
+ ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
7866
+ );
7849
7867
  }
7850
7868
 
7851
7869
  // Convert data if not already a string
@@ -8464,7 +8482,7 @@ if ( jQuery.support.ajax ) {
8464
8482
  // on any attempt to access responseText (#11426)
8465
8483
  try {
8466
8484
  responses.text = xhr.responseText;
8467
- } catch( _ ) {
8485
+ } catch( e ) {
8468
8486
  }
8469
8487
 
8470
8488
  // Firefox throws an exception when accessing
@@ -8617,7 +8635,9 @@ function Animation( elem, properties, options ) {
8617
8635
  tick = function() {
8618
8636
  var currentTime = fxNow || createFxNow(),
8619
8637
  remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
8620
- percent = 1 - ( remaining / animation.duration || 0 ),
8638
+ // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
8639
+ temp = remaining / animation.duration || 0,
8640
+ percent = 1 - temp,
8621
8641
  index = 0,
8622
8642
  length = animation.tweens.length;
8623
8643
 
@@ -8769,7 +8789,7 @@ jQuery.Animation = jQuery.extend( Animation, {
8769
8789
  });
8770
8790
 
8771
8791
  function defaultPrefilter( elem, props, opts ) {
8772
- var index, prop, value, length, dataShow, tween, hooks, oldfire,
8792
+ var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
8773
8793
  anim = this,
8774
8794
  style = elem.style,
8775
8795
  orig = {},
@@ -8843,6 +8863,7 @@ function defaultPrefilter( elem, props, opts ) {
8843
8863
  value = props[ index ];
8844
8864
  if ( rfxtypes.exec( value ) ) {
8845
8865
  delete props[ index ];
8866
+ toggle = toggle || value === "toggle";
8846
8867
  if ( value === ( hidden ? "hide" : "show" ) ) {
8847
8868
  continue;
8848
8869
  }
@@ -8853,6 +8874,14 @@ function defaultPrefilter( elem, props, opts ) {
8853
8874
  length = handled.length;
8854
8875
  if ( length ) {
8855
8876
  dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
8877
+ if ( "hidden" in dataShow ) {
8878
+ hidden = dataShow.hidden;
8879
+ }
8880
+
8881
+ // store state if its toggle - enables .stop().toggle() to "reverse"
8882
+ if ( toggle ) {
8883
+ dataShow.hidden = !hidden;
8884
+ }
8856
8885
  if ( hidden ) {
8857
8886
  jQuery( elem ).show();
8858
8887
  } else {
@@ -9149,6 +9178,8 @@ jQuery.fx.tick = function() {
9149
9178
  timers = jQuery.timers,
9150
9179
  i = 0;
9151
9180
 
9181
+ fxNow = jQuery.now();
9182
+
9152
9183
  for ( ; i < timers.length; i++ ) {
9153
9184
  timer = timers[ i ];
9154
9185
  // Checks the timer has not already been removed
@@ -9160,6 +9191,7 @@ jQuery.fx.tick = function() {
9160
9191
  if ( !timers.length ) {
9161
9192
  jQuery.fx.stop();
9162
9193
  }
9194
+ fxNow = undefined;
9163
9195
  };
9164
9196
 
9165
9197
  jQuery.fx.timer = function( timer ) {