jquery-source 1.8.1 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -31,7 +31,8 @@ end
31
31
 
32
32
  task :make_all_versions do
33
33
  # versions = "1.2.6, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.7.0, 1.7.1".split(", ")
34
- versions = "2.0.0, 1.9.1, 1.9.0, 1.8.3, 1.8.2, 1.8.1, 1.8.0, 1.7.2".split(", ").reverse()
34
+ # , 1.8.1, 1.8.0, 1.7.2
35
+ versions = "2.0.0, 1.9.1, 1.9.0, 1.8.3, 1.8.2".split(", ").reverse()
35
36
 
36
37
  versions.each do |version|
37
38
  make_version(version)
@@ -1,5 +1,5 @@
1
1
  module Jquery
2
2
  module Source
3
- VERSION = "1.8.1"
3
+ VERSION = "1.8.2"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * jQuery JavaScript Library v1.8.1
2
+ * jQuery JavaScript Library v1.8.2
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 Aug 30 2012 17:17:22 GMT-0400 (Eastern Daylight Time)
12
+ * Date: Thu Sep 20 2012 21:13:05 GMT-0400 (Eastern Daylight 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.1",
189
+ jquery: "1.8.2",
190
190
 
191
191
  // The default length of a jQuery object is 0
192
192
  length: 0,
@@ -573,7 +573,7 @@ jQuery.extend({
573
573
  },
574
574
 
575
575
  nodeName: function( elem, name ) {
576
- return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
576
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
577
577
  },
578
578
 
579
579
  // args is for internal usage only
@@ -630,7 +630,7 @@ jQuery.extend({
630
630
  function( text ) {
631
631
  return text == null ?
632
632
  "" :
633
- text.toString().replace( rtrim, "" );
633
+ ( text + "" ).replace( rtrim, "" );
634
634
  },
635
635
 
636
636
  // results is for internal usage only
@@ -776,7 +776,7 @@ jQuery.extend({
776
776
  };
777
777
 
778
778
  // Set the guid of unique handler to the same of original handler, so it can be removed
779
- proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
779
+ proxy.guid = fn.guid = fn.guid || jQuery.guid++;
780
780
 
781
781
  return proxy;
782
782
  },
@@ -1143,7 +1143,7 @@ jQuery.extend({
1143
1143
  // Get a promise for this deferred
1144
1144
  // If obj is provided, the promise aspect is added to the object
1145
1145
  promise: function( obj ) {
1146
- return typeof obj === "object" ? jQuery.extend( obj, promise ) : promise;
1146
+ return obj != null ? jQuery.extend( obj, promise ) : promise;
1147
1147
  }
1148
1148
  },
1149
1149
  deferred = {};
@@ -1262,7 +1262,7 @@ jQuery.support = (function() {
1262
1262
  a.style.cssText = "top:1px;float:left;opacity:.5";
1263
1263
 
1264
1264
  // Can't get basic test support
1265
- if ( !all || !all.length || !a ) {
1265
+ if ( !all || !all.length ) {
1266
1266
  return {};
1267
1267
  }
1268
1268
 
@@ -1513,7 +1513,7 @@ jQuery.extend({
1513
1513
 
1514
1514
  deletedIds: [],
1515
1515
 
1516
- // Please use with caution
1516
+ // Remove at next major release (1.9/2.0)
1517
1517
  uuid: 0,
1518
1518
 
1519
1519
  // Unique for each copy of jQuery on the page
@@ -1565,7 +1565,7 @@ jQuery.extend({
1565
1565
  // Only DOM nodes need a new unique ID for each element since their data
1566
1566
  // ends up in the global cache
1567
1567
  if ( isNode ) {
1568
- elem[ internalKey ] = id = jQuery.deletedIds.pop() || ++jQuery.uuid;
1568
+ elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++;
1569
1569
  } else {
1570
1570
  id = internalKey;
1571
1571
  }
@@ -1739,7 +1739,7 @@ jQuery.fn.extend({
1739
1739
  for ( l = attr.length; i < l; i++ ) {
1740
1740
  name = attr[i].name;
1741
1741
 
1742
- if ( name.indexOf( "data-" ) === 0 ) {
1742
+ if ( !name.indexOf( "data-" ) ) {
1743
1743
  name = jQuery.camelCase( name.substring(5) );
1744
1744
 
1745
1745
  dataAttr( elem, name, data[ name ] );
@@ -2049,7 +2049,7 @@ jQuery.fn.extend({
2049
2049
  setClass = " " + elem.className + " ";
2050
2050
 
2051
2051
  for ( c = 0, cl = classNames.length; c < cl; c++ ) {
2052
- if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
2052
+ if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) {
2053
2053
  setClass += classNames[ c ] + " ";
2054
2054
  }
2055
2055
  }
@@ -2082,7 +2082,7 @@ jQuery.fn.extend({
2082
2082
  // loop over each item in the removal list
2083
2083
  for ( c = 0, cl = removes.length; c < cl; c++ ) {
2084
2084
  // Remove until there is nothing to remove,
2085
- while ( className.indexOf(" " + removes[ c ] + " ") > -1 ) {
2085
+ while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) {
2086
2086
  className = className.replace( " " + removes[ c ] + " " , " " );
2087
2087
  }
2088
2088
  }
@@ -2136,7 +2136,7 @@ jQuery.fn.extend({
2136
2136
  i = 0,
2137
2137
  l = this.length;
2138
2138
  for ( ; i < l; i++ ) {
2139
- if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
2139
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
2140
2140
  return true;
2141
2141
  }
2142
2142
  }
@@ -2314,7 +2314,7 @@ jQuery.extend({
2314
2314
  return ret;
2315
2315
 
2316
2316
  } else {
2317
- elem.setAttribute( name, "" + value );
2317
+ elem.setAttribute( name, value + "" );
2318
2318
  return value;
2319
2319
  }
2320
2320
 
@@ -2578,7 +2578,7 @@ if ( !jQuery.support.style ) {
2578
2578
  return elem.style.cssText.toLowerCase() || undefined;
2579
2579
  },
2580
2580
  set: function( elem, value ) {
2581
- return ( elem.style.cssText = "" + value );
2581
+ return ( elem.style.cssText = value + "" );
2582
2582
  }
2583
2583
  };
2584
2584
  }
@@ -2711,6 +2711,7 @@ jQuery.event = {
2711
2711
  handler: handler,
2712
2712
  guid: handler.guid,
2713
2713
  selector: selector,
2714
+ needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
2714
2715
  namespace: namespaces.join(".")
2715
2716
  }, handleObjIn );
2716
2717
 
@@ -2946,7 +2947,7 @@ jQuery.event = {
2946
2947
  }
2947
2948
  // Note that this is a bare JS function and not a jQuery handler
2948
2949
  handle = ontype && cur[ ontype ];
2949
- if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
2950
+ if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
2950
2951
  event.preventDefault();
2951
2952
  }
2952
2953
  }
@@ -2994,7 +2995,7 @@ jQuery.event = {
2994
2995
  var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related,
2995
2996
  handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
2996
2997
  delegateCount = handlers.delegateCount,
2997
- args = [].slice.call( arguments ),
2998
+ args = core_slice.call( arguments ),
2998
2999
  run_all = !event.exclusive && !event.namespace,
2999
3000
  special = jQuery.event.special[ event.type ] || {},
3000
3001
  handlerQueue = [];
@@ -3023,7 +3024,9 @@ jQuery.event = {
3023
3024
  sel = handleObj.selector;
3024
3025
 
3025
3026
  if ( selMatch[ sel ] === undefined ) {
3026
- selMatch[ sel ] = jQuery( sel, this ).index( cur ) >= 0;
3027
+ selMatch[ sel ] = handleObj.needsContext ?
3028
+ jQuery( sel, this ).index( cur ) >= 0 :
3029
+ jQuery.find( sel, this, null, [ cur ] ).length;
3027
3030
  }
3028
3031
  if ( selMatch[ sel ] ) {
3029
3032
  matches.push( handleObj );
@@ -3593,7 +3596,7 @@ jQuery.fn.extend({
3593
3596
  },
3594
3597
  undelegate: function( selector, types, fn ) {
3595
3598
  // ( namespace ) or ( selector, types [, fn] )
3596
- return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
3599
+ return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
3597
3600
  },
3598
3601
 
3599
3602
  trigger: function( type, data ) {
@@ -3662,1532 +3665,1667 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
3662
3665
  jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
3663
3666
  }
3664
3667
  });
3665
- /*!
3666
- * Sizzle CSS Selector Engine
3667
- * Copyright 2012 jQuery Foundation and other contributors
3668
- * Released under the MIT license
3669
- * http://sizzlejs.com/
3670
- */
3671
- (function( window, undefined ) {
3672
-
3673
- var dirruns,
3674
- cachedruns,
3675
- assertGetIdNotName,
3676
- Expr,
3677
- getText,
3678
- isXML,
3679
- contains,
3680
- compile,
3681
- sortOrder,
3682
- hasDuplicate,
3683
-
3684
- baseHasDuplicate = true,
3685
- strundefined = "undefined",
3686
-
3687
- expando = ( "sizcache" + Math.random() ).replace( ".", "" ),
3688
-
3689
- document = window.document,
3690
- docElem = document.documentElement,
3691
- done = 0,
3692
- slice = [].slice,
3693
- push = [].push,
3694
-
3695
- // Augment a function for special use by Sizzle
3696
- markFunction = function( fn, value ) {
3697
- fn[ expando ] = value || true;
3698
- return fn;
3699
- },
3700
-
3701
- createCache = function() {
3702
- var cache = {},
3703
- keys = [];
3704
-
3705
- return markFunction(function( key, value ) {
3706
- // Only keep the most recent entries
3707
- if ( keys.push( key ) > Expr.cacheLength ) {
3708
- delete cache[ keys.shift() ];
3709
- }
3710
-
3711
- return (cache[ key ] = value);
3712
- }, cache );
3713
- },
3714
-
3715
- classCache = createCache(),
3716
- tokenCache = createCache(),
3717
- compilerCache = createCache(),
3718
-
3719
- // Regex
3720
-
3721
- // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
3722
- whitespace = "[\\x20\\t\\r\\n\\f]",
3723
- // http://www.w3.org/TR/css3-syntax/#characters
3724
- characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",
3725
-
3726
- // Loosely modeled on CSS identifier characters
3727
- // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)
3728
- // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
3729
- identifier = characterEncoding.replace( "w", "w#" ),
3730
-
3731
- // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
3732
- operators = "([*^$|!~]?=)",
3733
- attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
3734
- "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
3735
-
3736
- // Prefer arguments not in parens/brackets,
3737
- // then attribute selectors and non-pseudos (denoted by :),
3738
- // then anything else
3739
- // These preferences are here to reduce the number of selectors
3740
- // needing tokenize in the PSEUDO preFilter
3741
- pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)",
3742
-
3743
- // For matchExpr.POS and matchExpr.needsContext
3744
- pos = ":(nth|eq|gt|lt|first|last|even|odd)(?:\\(((?:-\\d)?\\d*)\\)|)(?=[^-]|$)",
3745
-
3746
- // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
3747
- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
3748
-
3749
- rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
3750
- rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
3751
- rpseudo = new RegExp( pseudos ),
3752
-
3753
- // Easily-parseable/retrievable ID or TAG or CLASS selectors
3754
- rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,
3755
-
3756
- rnot = /^:not/,
3757
- rsibling = /[\x20\t\r\n\f]*[+~]/,
3758
- rendsWithNot = /:not\($/,
3759
-
3760
- rheader = /h\d/i,
3761
- rinputs = /input|select|textarea|button/i,
3762
-
3763
- rbackslash = /\\(?!\\)/g,
3764
-
3765
- matchExpr = {
3766
- "ID": new RegExp( "^#(" + characterEncoding + ")" ),
3767
- "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
3768
- "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
3769
- "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
3770
- "ATTR": new RegExp( "^" + attributes ),
3771
- "PSEUDO": new RegExp( "^" + pseudos ),
3772
- "CHILD": new RegExp( "^:(only|nth|last|first)-child(?:\\(" + whitespace +
3773
- "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
3774
- "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
3775
- "POS": new RegExp( pos, "ig" ),
3776
- // For use in libraries implementing .is()
3777
- "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" )
3778
- },
3779
-
3780
- // Support
3781
-
3782
- // Used for testing something on an element
3783
- assert = function( fn ) {
3784
- var div = document.createElement("div");
3785
-
3786
- try {
3787
- return fn( div );
3788
- } catch (e) {
3789
- return false;
3790
- } finally {
3791
- // release memory in IE
3792
- div = null;
3793
- }
3794
- },
3795
-
3796
- // Check if getElementsByTagName("*") returns only elements
3797
- assertTagNameNoComments = assert(function( div ) {
3798
- div.appendChild( document.createComment("") );
3799
- return !div.getElementsByTagName("*").length;
3800
- }),
3801
-
3802
- // Check if getAttribute returns normalized href attributes
3803
- assertHrefNotNormalized = assert(function( div ) {
3804
- div.innerHTML = "<a href='#'></a>";
3805
- return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
3806
- div.firstChild.getAttribute("href") === "#";
3807
- }),
3808
-
3809
- // Check if attributes should be retrieved by attribute nodes
3810
- assertAttributes = assert(function( div ) {
3811
- div.innerHTML = "<select></select>";
3812
- var type = typeof div.lastChild.getAttribute("multiple");
3813
- // IE8 returns a string for some attributes even when not present
3814
- return type !== "boolean" && type !== "string";
3815
- }),
3816
-
3817
- // Check if getElementsByClassName can be trusted
3818
- assertUsableClassName = assert(function( div ) {
3819
- // Opera can't find a second classname (in 9.6)
3820
- div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
3821
- if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
3822
- return false;
3823
- }
3824
-
3825
- // Safari 3.2 caches class attributes and doesn't catch changes
3826
- div.lastChild.className = "e";
3827
- return div.getElementsByClassName("e").length === 2;
3828
- }),
3829
-
3830
- // Check if getElementById returns elements by name
3831
- // Check if getElementsByName privileges form controls or returns elements by ID
3832
- assertUsableName = assert(function( div ) {
3833
- // Inject content
3834
- div.id = expando + 0;
3835
- div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
3836
- docElem.insertBefore( div, docElem.firstChild );
3837
-
3838
- // Test
3839
- var pass = document.getElementsByName &&
3840
- // buggy browsers will return fewer than the correct 2
3841
- document.getElementsByName( expando ).length === 2 +
3842
- // buggy browsers will return more than the correct 0
3843
- document.getElementsByName( expando + 0 ).length;
3844
- assertGetIdNotName = !document.getElementById( expando );
3845
-
3846
- // Cleanup
3847
- docElem.removeChild( div );
3848
-
3849
- return pass;
3850
- });
3851
-
3852
- // If slice is not available, provide a backup
3853
- try {
3854
- slice.call( docElem.childNodes, 0 )[0].nodeType;
3855
- } catch ( e ) {
3856
- slice = function( i ) {
3857
- var elem, results = [];
3858
- for ( ; (elem = this[i]); i++ ) {
3859
- results.push( elem );
3860
- }
3861
- return results;
3862
- };
3863
- }
3864
-
3865
- function Sizzle( selector, context, results, seed ) {
3866
- results = results || [];
3867
- context = context || document;
3868
- var match, elem, xml, m,
3869
- nodeType = context.nodeType;
3870
-
3871
- if ( nodeType !== 1 && nodeType !== 9 ) {
3872
- return [];
3873
- }
3874
-
3875
- if ( !selector || typeof selector !== "string" ) {
3876
- return results;
3877
- }
3878
-
3879
- xml = isXML( context );
3880
-
3881
- if ( !xml && !seed ) {
3882
- if ( (match = rquickExpr.exec( selector )) ) {
3883
- // Speed-up: Sizzle("#ID")
3884
- if ( (m = match[1]) ) {
3885
- if ( nodeType === 9 ) {
3886
- elem = context.getElementById( m );
3887
- // Check parentNode to catch when Blackberry 4.6 returns
3888
- // nodes that are no longer in the document #6963
3889
- if ( elem && elem.parentNode ) {
3890
- // Handle the case where IE, Opera, and Webkit return items
3891
- // by name instead of ID
3892
- if ( elem.id === m ) {
3893
- results.push( elem );
3894
- return results;
3895
- }
3896
- } else {
3897
- return results;
3898
- }
3899
- } else {
3900
- // Context is not a document
3901
- if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
3902
- contains( context, elem ) && elem.id === m ) {
3903
- results.push( elem );
3904
- return results;
3905
- }
3906
- }
3907
-
3908
- // Speed-up: Sizzle("TAG")
3909
- } else if ( match[2] ) {
3910
- push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
3911
- return results;
3912
-
3913
- // Speed-up: Sizzle(".CLASS")
3914
- } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {
3915
- push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
3916
- return results;
3917
- }
3918
- }
3919
- }
3920
-
3921
- // All others
3922
- return select( selector, context, results, seed, xml );
3923
- }
3924
-
3925
- Sizzle.matches = function( expr, elements ) {
3926
- return Sizzle( expr, null, null, elements );
3927
- };
3928
-
3929
- Sizzle.matchesSelector = function( elem, expr ) {
3930
- return Sizzle( expr, null, null, [ elem ] ).length > 0;
3931
- };
3932
-
3933
- // Returns a function to use in pseudos for input types
3934
- function createInputPseudo( type ) {
3935
- return function( elem ) {
3936
- var name = elem.nodeName.toLowerCase();
3937
- return name === "input" && elem.type === type;
3938
- };
3939
- }
3940
-
3941
- // Returns a function to use in pseudos for buttons
3942
- function createButtonPseudo( type ) {
3943
- return function( elem ) {
3944
- var name = elem.nodeName.toLowerCase();
3945
- return (name === "input" || name === "button") && elem.type === type;
3946
- };
3947
- }
3948
-
3949
- /**
3950
- * Utility function for retrieving the text value of an array of DOM nodes
3951
- * @param {Array|Element} elem
3952
- */
3953
- getText = Sizzle.getText = function( elem ) {
3954
- var node,
3955
- ret = "",
3956
- i = 0,
3957
- nodeType = elem.nodeType;
3958
-
3959
- if ( nodeType ) {
3960
- if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
3961
- // Use textContent for elements
3962
- // innerText usage removed for consistency of new lines (see #11153)
3963
- if ( typeof elem.textContent === "string" ) {
3964
- return elem.textContent;
3965
- } else {
3966
- // Traverse its children
3967
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
3968
- ret += getText( elem );
3969
- }
3970
- }
3971
- } else if ( nodeType === 3 || nodeType === 4 ) {
3972
- return elem.nodeValue;
3973
- }
3974
- // Do not include comment or processing instruction nodes
3975
- } else {
3976
-
3977
- // If no nodeType, this is expected to be an array
3978
- for ( ; (node = elem[i]); i++ ) {
3979
- // Do not traverse comment nodes
3980
- ret += getText( node );
3981
- }
3982
- }
3983
- return ret;
3984
- };
3985
-
3986
- isXML = Sizzle.isXML = function isXML( elem ) {
3987
- // documentElement is verified for cases where it doesn't yet exist
3988
- // (such as loading iframes in IE - #4833)
3989
- var documentElement = elem && (elem.ownerDocument || elem).documentElement;
3990
- return documentElement ? documentElement.nodeName !== "HTML" : false;
3991
- };
3992
-
3993
- // Element contains another
3994
- contains = Sizzle.contains = docElem.contains ?
3995
- function( a, b ) {
3996
- var adown = a.nodeType === 9 ? a.documentElement : a,
3997
- bup = b && b.parentNode;
3998
- return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );
3999
- } :
4000
- docElem.compareDocumentPosition ?
4001
- function( a, b ) {
4002
- return b && !!( a.compareDocumentPosition( b ) & 16 );
4003
- } :
4004
- function( a, b ) {
4005
- while ( (b = b.parentNode) ) {
4006
- if ( b === a ) {
4007
- return true;
4008
- }
4009
- }
4010
- return false;
4011
- };
4012
-
4013
- Sizzle.attr = function( elem, name ) {
4014
- var attr,
4015
- xml = isXML( elem );
4016
-
4017
- if ( !xml ) {
4018
- name = name.toLowerCase();
4019
- }
4020
- if ( Expr.attrHandle[ name ] ) {
4021
- return Expr.attrHandle[ name ]( elem );
4022
- }
4023
- if ( assertAttributes || xml ) {
4024
- return elem.getAttribute( name );
4025
- }
4026
- attr = elem.getAttributeNode( name );
4027
- return attr ?
4028
- typeof elem[ name ] === "boolean" ?
4029
- elem[ name ] ? name : null :
4030
- attr.specified ? attr.value : null :
4031
- null;
4032
- };
4033
-
4034
- Expr = Sizzle.selectors = {
4035
-
4036
- // Can be adjusted by the user
4037
- cacheLength: 50,
4038
-
4039
- createPseudo: markFunction,
4040
-
4041
- match: matchExpr,
4042
-
4043
- order: new RegExp( "ID|TAG" +
4044
- (assertUsableName ? "|NAME" : "") +
4045
- (assertUsableClassName ? "|CLASS" : "")
4046
- ),
4047
-
4048
- // IE6/7 return a modified href
4049
- attrHandle: assertHrefNotNormalized ?
4050
- {} :
4051
- {
4052
- "href": function( elem ) {
4053
- return elem.getAttribute( "href", 2 );
4054
- },
4055
- "type": function( elem ) {
4056
- return elem.getAttribute("type");
4057
- }
4058
- },
4059
-
4060
- find: {
4061
- "ID": assertGetIdNotName ?
4062
- function( id, context, xml ) {
4063
- if ( typeof context.getElementById !== strundefined && !xml ) {
4064
- var m = context.getElementById( id );
4065
- // Check parentNode to catch when Blackberry 4.6 returns
4066
- // nodes that are no longer in the document #6963
4067
- return m && m.parentNode ? [m] : [];
4068
- }
4069
- } :
4070
- function( id, context, xml ) {
4071
- if ( typeof context.getElementById !== strundefined && !xml ) {
4072
- var m = context.getElementById( id );
4073
-
4074
- return m ?
4075
- m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
4076
- [m] :
4077
- undefined :
4078
- [];
4079
- }
4080
- },
4081
-
4082
- "TAG": assertTagNameNoComments ?
4083
- function( tag, context ) {
4084
- if ( typeof context.getElementsByTagName !== strundefined ) {
4085
- return context.getElementsByTagName( tag );
4086
- }
4087
- } :
4088
- function( tag, context ) {
4089
- var results = context.getElementsByTagName( tag );
4090
-
4091
- // Filter out possible comments
4092
- if ( tag === "*" ) {
4093
- var elem,
4094
- tmp = [],
4095
- i = 0;
4096
-
4097
- for ( ; (elem = results[i]); i++ ) {
4098
- if ( elem.nodeType === 1 ) {
4099
- tmp.push( elem );
4100
- }
4101
- }
4102
-
4103
- return tmp;
4104
- }
4105
- return results;
4106
- },
4107
-
4108
- "NAME": function( tag, context ) {
4109
- if ( typeof context.getElementsByName !== strundefined ) {
4110
- return context.getElementsByName( name );
4111
- }
4112
- },
4113
-
4114
- "CLASS": function( className, context, xml ) {
4115
- if ( typeof context.getElementsByClassName !== strundefined && !xml ) {
4116
- return context.getElementsByClassName( className );
4117
- }
4118
- }
4119
- },
4120
-
4121
- relative: {
4122
- ">": { dir: "parentNode", first: true },
4123
- " ": { dir: "parentNode" },
4124
- "+": { dir: "previousSibling", first: true },
4125
- "~": { dir: "previousSibling" }
4126
- },
4127
-
4128
- preFilter: {
4129
- "ATTR": function( match ) {
4130
- match[1] = match[1].replace( rbackslash, "" );
4131
-
4132
- // Move the given value to match[3] whether quoted or unquoted
4133
- match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );
4134
-
4135
- if ( match[2] === "~=" ) {
4136
- match[3] = " " + match[3] + " ";
4137
- }
4138
-
4139
- return match.slice( 0, 4 );
4140
- },
4141
-
4142
- "CHILD": function( match ) {
4143
- /* matches from matchExpr.CHILD
4144
- 1 type (only|nth|...)
4145
- 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4146
- 3 xn-component of xn+y argument ([+-]?\d*n|)
4147
- 4 sign of xn-component
4148
- 5 x of xn-component
4149
- 6 sign of y-component
4150
- 7 y of y-component
4151
- */
4152
- match[1] = match[1].toLowerCase();
4153
-
4154
- if ( match[1] === "nth" ) {
4155
- // nth-child requires argument
4156
- if ( !match[2] ) {
4157
- Sizzle.error( match[0] );
4158
- }
4159
-
4160
- // numeric x and y parameters for Expr.filter.CHILD
4161
- // remember that false/true cast respectively to 0/1
4162
- match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) );
4163
- match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" );
4164
-
4165
- // other types prohibit arguments
4166
- } else if ( match[2] ) {
4167
- Sizzle.error( match[0] );
4168
- }
4169
-
4170
- return match;
4171
- },
4172
-
4173
- "PSEUDO": function( match, context, xml ) {
4174
- var unquoted, excess;
4175
- if ( matchExpr["CHILD"].test( match[0] ) ) {
4176
- return null;
4177
- }
4178
-
4179
- if ( match[3] ) {
4180
- match[2] = match[3];
4181
- } else if ( (unquoted = match[4]) ) {
4182
- // Only check arguments that contain a pseudo
4183
- if ( rpseudo.test(unquoted) &&
4184
- // Get excess from tokenize (recursively)
4185
- (excess = tokenize( unquoted, context, xml, true )) &&
4186
- // advance to the next closing parenthesis
4187
- (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
4188
-
4189
- // excess is a negative index
4190
- unquoted = unquoted.slice( 0, excess );
4191
- match[0] = match[0].slice( 0, excess );
4192
- }
4193
- match[2] = unquoted;
4194
- }
4195
-
4196
- // Return only captures needed by the pseudo filter method (type and argument)
4197
- return match.slice( 0, 3 );
4198
- }
4199
- },
4200
-
4201
- filter: {
4202
- "ID": assertGetIdNotName ?
4203
- function( id ) {
4204
- id = id.replace( rbackslash, "" );
4205
- return function( elem ) {
4206
- return elem.getAttribute("id") === id;
4207
- };
4208
- } :
4209
- function( id ) {
4210
- id = id.replace( rbackslash, "" );
4211
- return function( elem ) {
4212
- var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
4213
- return node && node.value === id;
4214
- };
4215
- },
4216
-
4217
- "TAG": function( nodeName ) {
4218
- if ( nodeName === "*" ) {
4219
- return function() { return true; };
4220
- }
4221
- nodeName = nodeName.replace( rbackslash, "" ).toLowerCase();
4222
-
4223
- return function( elem ) {
4224
- return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
4225
- };
4226
- },
4227
-
4228
- "CLASS": function( className ) {
4229
- var pattern = classCache[ expando ][ className ];
4230
- if ( !pattern ) {
4231
- pattern = classCache( className, new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)") );
4232
- }
4233
- return function( elem ) {
4234
- return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
4235
- };
4236
- },
4237
-
4238
- "ATTR": function( name, operator, check ) {
4239
- if ( !operator ) {
4240
- return function( elem ) {
4241
- return Sizzle.attr( elem, name ) != null;
4242
- };
4243
- }
4244
-
4245
- return function( elem ) {
4246
- var result = Sizzle.attr( elem, name ),
4247
- value = result + "";
4248
-
4249
- if ( result == null ) {
4250
- return operator === "!=";
4251
- }
4252
-
4253
- switch ( operator ) {
4254
- case "=":
4255
- return value === check;
4256
- case "!=":
4257
- return value !== check;
4258
- case "^=":
4259
- return check && value.indexOf( check ) === 0;
4260
- case "*=":
4261
- return check && value.indexOf( check ) > -1;
4262
- case "$=":
4263
- return check && value.substr( value.length - check.length ) === check;
4264
- case "~=":
4265
- return ( " " + value + " " ).indexOf( check ) > -1;
4266
- case "|=":
4267
- return value === check || value.substr( 0, check.length + 1 ) === check + "-";
4268
- }
4269
- };
4270
- },
4271
-
4272
- "CHILD": function( type, argument, first, last ) {
4273
-
4274
- if ( type === "nth" ) {
4275
- var doneName = done++;
4276
-
4277
- return function( elem ) {
4278
- var parent, diff,
4279
- count = 0,
4280
- node = elem;
4281
-
4282
- if ( first === 1 && last === 0 ) {
4283
- return true;
4284
- }
4285
-
4286
- parent = elem.parentNode;
4287
-
4288
- if ( parent && (parent[ expando ] !== doneName || !elem.sizset) ) {
4289
- for ( node = parent.firstChild; node; node = node.nextSibling ) {
4290
- if ( node.nodeType === 1 ) {
4291
- node.sizset = ++count;
4292
- if ( node === elem ) {
4293
- break;
4294
- }
4295
- }
4296
- }
4297
-
4298
- parent[ expando ] = doneName;
4299
- }
4300
-
4301
- diff = elem.sizset - last;
4302
-
4303
- if ( first === 0 ) {
4304
- return diff === 0;
4305
-
4306
- } else {
4307
- return ( diff % first === 0 && diff / first >= 0 );
4308
- }
4309
- };
4310
- }
4311
-
4312
- return function( elem ) {
4313
- var node = elem;
4314
-
4315
- switch ( type ) {
4316
- case "only":
4317
- case "first":
4318
- while ( (node = node.previousSibling) ) {
4319
- if ( node.nodeType === 1 ) {
4320
- return false;
4321
- }
4322
- }
4323
-
4324
- if ( type === "first" ) {
4325
- return true;
4326
- }
4327
-
4328
- node = elem;
4329
-
4330
- /* falls through */
4331
- case "last":
4332
- while ( (node = node.nextSibling) ) {
4333
- if ( node.nodeType === 1 ) {
4334
- return false;
4335
- }
4336
- }
4337
-
4338
- return true;
4339
- }
4340
- };
4341
- },
4342
-
4343
- "PSEUDO": function( pseudo, argument, context, xml ) {
4344
- // pseudo-class names are case-insensitive
4345
- // http://www.w3.org/TR/selectors/#pseudo-classes
4346
- // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
4347
- var args,
4348
- fn = Expr.pseudos[ pseudo ] || Expr.pseudos[ pseudo.toLowerCase() ];
4349
-
4350
- if ( !fn ) {
4351
- Sizzle.error( "unsupported pseudo: " + pseudo );
4352
- }
4353
-
4354
- // The user may use createPseudo to indicate that
4355
- // arguments are needed to create the filter function
4356
- // just as Sizzle does
4357
- if ( !fn[ expando ] ) {
4358
- if ( fn.length > 1 ) {
4359
- args = [ pseudo, pseudo, "", argument ];
4360
- return function( elem ) {
4361
- return fn( elem, 0, args );
4362
- };
4363
- }
4364
- return fn;
4365
- }
4366
-
4367
- return fn( argument, context, xml );
4368
- }
4369
- },
4370
-
4371
- pseudos: {
4372
- "not": markFunction(function( selector, context, xml ) {
4373
- // Trim the selector passed to compile
4374
- // to avoid treating leading and trailing
4375
- // spaces as combinators
4376
- var matcher = compile( selector.replace( rtrim, "$1" ), context, xml );
4377
- return function( elem ) {
4378
- return !matcher( elem );
4379
- };
4380
- }),
4381
-
4382
- "enabled": function( elem ) {
4383
- return elem.disabled === false;
4384
- },
4385
-
4386
- "disabled": function( elem ) {
4387
- return elem.disabled === true;
4388
- },
4389
-
4390
- "checked": function( elem ) {
4391
- // In CSS3, :checked should return both checked and selected elements
4392
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
4393
- var nodeName = elem.nodeName.toLowerCase();
4394
- return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
4395
- },
4396
-
4397
- "selected": function( elem ) {
4398
- // Accessing this property makes selected-by-default
4399
- // options in Safari work properly
4400
- if ( elem.parentNode ) {
4401
- elem.parentNode.selectedIndex;
4402
- }
4403
-
4404
- return elem.selected === true;
4405
- },
4406
-
4407
- "parent": function( elem ) {
4408
- return !Expr.pseudos["empty"]( elem );
4409
- },
4410
-
4411
- "empty": function( elem ) {
4412
- // http://www.w3.org/TR/selectors/#empty-pseudo
4413
- // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
4414
- // not comment, processing instructions, or others
4415
- // Thanks to Diego Perini for the nodeName shortcut
4416
- // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
4417
- var nodeType;
4418
- elem = elem.firstChild;
4419
- while ( elem ) {
4420
- if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {
4421
- return false;
4422
- }
4423
- elem = elem.nextSibling;
4424
- }
4425
- return true;
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
- "has": markFunction(function( selector ) {
4435
- return function( elem ) {
4436
- return Sizzle( selector, elem ).length > 0;
4437
- };
4438
- }),
4439
-
4440
- "header": function( elem ) {
4441
- return rheader.test( elem.nodeName );
4442
- },
4443
-
4444
- "text": function( elem ) {
4445
- var type, attr;
4446
- // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
4447
- // use getAttribute instead to test this case
4448
- return elem.nodeName.toLowerCase() === "input" &&
4449
- (type = elem.type) === "text" &&
4450
- ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type );
4451
- },
4452
-
4453
- // Input types
4454
- "radio": createInputPseudo("radio"),
4455
- "checkbox": createInputPseudo("checkbox"),
4456
- "file": createInputPseudo("file"),
4457
- "password": createInputPseudo("password"),
4458
- "image": createInputPseudo("image"),
4459
-
4460
- "submit": createButtonPseudo("submit"),
4461
- "reset": createButtonPseudo("reset"),
4462
-
4463
- "button": function( elem ) {
4464
- var name = elem.nodeName.toLowerCase();
4465
- return name === "input" && elem.type === "button" || name === "button";
4466
- },
4467
-
4468
- "input": function( elem ) {
4469
- return rinputs.test( elem.nodeName );
4470
- },
4471
-
4472
- "focus": function( elem ) {
4473
- var doc = elem.ownerDocument;
4474
- return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href);
4475
- },
4476
-
4477
- "active": function( elem ) {
4478
- return elem === elem.ownerDocument.activeElement;
4479
- }
4480
- },
4481
-
4482
- setFilters: {
4483
- "first": function( elements, argument, not ) {
4484
- return not ? elements.slice( 1 ) : [ elements[0] ];
4485
- },
4486
-
4487
- "last": function( elements, argument, not ) {
4488
- var elem = elements.pop();
4489
- return not ? elements : [ elem ];
4490
- },
4491
-
4492
- "even": function( elements, argument, not ) {
4493
- var results = [],
4494
- i = not ? 1 : 0,
4495
- len = elements.length;
4496
- for ( ; i < len; i = i + 2 ) {
4497
- results.push( elements[i] );
4498
- }
4499
- return results;
4500
- },
4501
-
4502
- "odd": function( elements, argument, not ) {
4503
- var results = [],
4504
- i = not ? 0 : 1,
4505
- len = elements.length;
4506
- for ( ; i < len; i = i + 2 ) {
4507
- results.push( elements[i] );
4508
- }
4509
- return results;
4510
- },
4511
-
4512
- "lt": function( elements, argument, not ) {
4513
- return not ? elements.slice( +argument ) : elements.slice( 0, +argument );
4514
- },
4515
-
4516
- "gt": function( elements, argument, not ) {
4517
- return not ? elements.slice( 0, +argument + 1 ) : elements.slice( +argument + 1 );
4518
- },
4519
-
4520
- "eq": function( elements, argument, not ) {
4521
- var elem = elements.splice( +argument, 1 );
4522
- return not ? elements : elem;
4523
- }
4524
- }
4525
- };
4526
-
4527
- function siblingCheck( a, b, ret ) {
4528
- if ( a === b ) {
4529
- return ret;
4530
- }
4531
-
4532
- var cur = a.nextSibling;
4533
-
4534
- while ( cur ) {
4535
- if ( cur === b ) {
4536
- return -1;
4537
- }
4538
-
4539
- cur = cur.nextSibling;
4540
- }
4541
-
4542
- return 1;
4543
- }
4544
-
4545
- sortOrder = docElem.compareDocumentPosition ?
4546
- function( a, b ) {
4547
- if ( a === b ) {
4548
- hasDuplicate = true;
4549
- return 0;
4550
- }
4551
-
4552
- return ( !a.compareDocumentPosition || !b.compareDocumentPosition ?
4553
- a.compareDocumentPosition :
4554
- a.compareDocumentPosition(b) & 4
4555
- ) ? -1 : 1;
4556
- } :
4557
- function( a, b ) {
4558
- // The nodes are identical, we can exit early
4559
- if ( a === b ) {
4560
- hasDuplicate = true;
4561
- return 0;
4562
-
4563
- // Fallback to using sourceIndex (in IE) if it's available on both nodes
4564
- } else if ( a.sourceIndex && b.sourceIndex ) {
4565
- return a.sourceIndex - b.sourceIndex;
4566
- }
4567
-
4568
- var al, bl,
4569
- ap = [],
4570
- bp = [],
4571
- aup = a.parentNode,
4572
- bup = b.parentNode,
4573
- cur = aup;
4574
-
4575
- // If the nodes are siblings (or identical) we can do a quick check
4576
- if ( aup === bup ) {
4577
- return siblingCheck( a, b );
4578
-
4579
- // If no parents were found then the nodes are disconnected
4580
- } else if ( !aup ) {
4581
- return -1;
4582
-
4583
- } else if ( !bup ) {
4584
- return 1;
4585
- }
4586
-
4587
- // Otherwise they're somewhere else in the tree so we need
4588
- // to build up a full list of the parentNodes for comparison
4589
- while ( cur ) {
4590
- ap.unshift( cur );
4591
- cur = cur.parentNode;
4592
- }
4593
-
4594
- cur = bup;
4595
-
4596
- while ( cur ) {
4597
- bp.unshift( cur );
4598
- cur = cur.parentNode;
4599
- }
4600
-
4601
- al = ap.length;
4602
- bl = bp.length;
4603
-
4604
- // Start walking down the tree looking for a discrepancy
4605
- for ( var i = 0; i < al && i < bl; i++ ) {
4606
- if ( ap[i] !== bp[i] ) {
4607
- return siblingCheck( ap[i], bp[i] );
4608
- }
4609
- }
4610
-
4611
- // We ended someplace up the tree so do a sibling check
4612
- return i === al ?
4613
- siblingCheck( a, bp[i], -1 ) :
4614
- siblingCheck( ap[i], b, 1 );
4615
- };
4616
-
4617
- // Always assume the presence of duplicates if sort doesn't
4618
- // pass them to our comparison function (as in Google Chrome).
4619
- [0, 0].sort( sortOrder );
4620
- baseHasDuplicate = !hasDuplicate;
4621
-
4622
- // Document sorting and removing duplicates
4623
- Sizzle.uniqueSort = function( results ) {
4624
- var elem,
4625
- i = 1;
4626
-
4627
- hasDuplicate = baseHasDuplicate;
4628
- results.sort( sortOrder );
4629
-
4630
- if ( hasDuplicate ) {
4631
- for ( ; (elem = results[i]); i++ ) {
4632
- if ( elem === results[ i - 1 ] ) {
4633
- results.splice( i--, 1 );
4634
- }
4635
- }
4636
- }
4637
-
4638
- return results;
4639
- };
4640
-
4641
- Sizzle.error = function( msg ) {
4642
- throw new Error( "Syntax error, unrecognized expression: " + msg );
4643
- };
4644
-
4645
- function tokenize( selector, context, xml, parseOnly ) {
4646
- var matched, match, tokens, type,
4647
- soFar, groups, group, i,
4648
- preFilters, filters,
4649
- checkContext = !xml && context !== document,
4650
- // Token cache should maintain spaces
4651
- key = ( checkContext ? "<s>" : "" ) + selector.replace( rtrim, "$1<s>" ),
4652
- cached = tokenCache[ expando ][ key ];
4653
-
4654
- if ( cached ) {
4655
- return parseOnly ? 0 : slice.call( cached, 0 );
4656
- }
4657
-
4658
- soFar = selector;
4659
- groups = [];
4660
- i = 0;
4661
- preFilters = Expr.preFilter;
4662
- filters = Expr.filter;
4663
-
4664
- while ( soFar ) {
4665
-
4666
- // Comma and first run
4667
- if ( !matched || (match = rcomma.exec( soFar )) ) {
4668
- if ( match ) {
4669
- soFar = soFar.slice( match[0].length );
4670
- tokens.selector = group;
4671
- }
4672
- groups.push( tokens = [] );
4673
- group = "";
4674
-
4675
- // Need to make sure we're within a narrower context if necessary
4676
- // Adding a descendant combinator will generate what is needed
4677
- if ( checkContext ) {
4678
- soFar = " " + soFar;
4679
- }
4680
- }
4681
-
4682
- matched = false;
4683
-
4684
- // Combinators
4685
- if ( (match = rcombinators.exec( soFar )) ) {
4686
- group += match[0];
4687
- soFar = soFar.slice( match[0].length );
4688
-
4689
- // Cast descendant combinators to space
4690
- matched = tokens.push({
4691
- part: match.pop().replace( rtrim, " " ),
4692
- string: match[0],
4693
- captures: match
4694
- });
4695
- }
4696
-
4697
- // Filters
4698
- for ( type in filters ) {
4699
- if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
4700
- ( match = preFilters[ type ](match, context, xml) )) ) {
4701
-
4702
- group += match[0];
4703
- soFar = soFar.slice( match[0].length );
4704
- matched = tokens.push({
4705
- part: type,
4706
- string: match.shift(),
4707
- captures: match
4708
- });
4709
- }
4710
- }
4711
-
4712
- if ( !matched ) {
4713
- break;
4714
- }
4715
- }
4716
-
4717
- // Attach the full group as a selector
4718
- if ( group ) {
4719
- tokens.selector = group;
4720
- }
4721
-
4722
- // Return the length of the invalid excess
4723
- // if we're just parsing
4724
- // Otherwise, throw an error or return tokens
4725
- return parseOnly ?
4726
- soFar.length :
4727
- soFar ?
4728
- Sizzle.error( selector ) :
4729
- // Cache the tokens
4730
- slice.call( tokenCache(key, groups), 0 );
4731
- }
4732
-
4733
- function addCombinator( matcher, combinator, context, xml ) {
4734
- var dir = combinator.dir,
4735
- doneName = done++;
4736
-
4737
- if ( !matcher ) {
4738
- // If there is no matcher to check, check against the context
4739
- matcher = function( elem ) {
4740
- return elem === context;
4741
- };
4742
- }
4743
- return combinator.first ?
4744
- function( elem ) {
4745
- while ( (elem = elem[ dir ]) ) {
4746
- if ( elem.nodeType === 1 ) {
4747
- return matcher( elem ) && elem;
4748
- }
4749
- }
4750
- } :
4751
- xml ?
4752
- function( elem ) {
4753
- while ( (elem = elem[ dir ]) ) {
4754
- if ( elem.nodeType === 1 ) {
4755
- if ( matcher( elem ) ) {
4756
- return elem;
4757
- }
4758
- }
4759
- }
4760
- } :
4761
- function( elem ) {
4762
- var cache,
4763
- dirkey = doneName + "." + dirruns,
4764
- cachedkey = dirkey + "." + cachedruns;
4765
- while ( (elem = elem[ dir ]) ) {
4766
- if ( elem.nodeType === 1 ) {
4767
- if ( (cache = elem[ expando ]) === cachedkey ) {
4768
- return elem.sizset;
4769
- } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) {
4770
- if ( elem.sizset ) {
4771
- return elem;
4772
- }
4773
- } else {
4774
- elem[ expando ] = cachedkey;
4775
- if ( matcher( elem ) ) {
4776
- elem.sizset = true;
4777
- return elem;
4778
- }
4779
- elem.sizset = false;
4780
- }
4781
- }
4782
- }
4783
- };
4784
- }
4785
-
4786
- function addMatcher( higher, deeper ) {
4787
- return higher ?
4788
- function( elem ) {
4789
- var result = deeper( elem );
4790
- return result && higher( result === true ? elem : result );
4791
- } :
4792
- deeper;
4793
- }
4794
-
4795
- // ["TAG", ">", "ID", " ", "CLASS"]
4796
- function matcherFromTokens( tokens, context, xml ) {
4797
- var token, matcher,
4798
- i = 0;
4799
-
4800
- for ( ; (token = tokens[i]); i++ ) {
4801
- if ( Expr.relative[ token.part ] ) {
4802
- matcher = addCombinator( matcher, Expr.relative[ token.part ], context, xml );
4803
- } else {
4804
- matcher = addMatcher( matcher, Expr.filter[ token.part ].apply(null, token.captures.concat( context, xml )) );
4805
- }
4806
- }
4807
-
4808
- return matcher;
4809
- }
4810
-
4811
- function matcherFromGroupMatchers( matchers ) {
4812
- return function( elem ) {
4813
- var matcher,
4814
- j = 0;
4815
- for ( ; (matcher = matchers[j]); j++ ) {
4816
- if ( matcher(elem) ) {
4817
- return true;
4818
- }
4819
- }
4820
- return false;
4821
- };
4822
- }
4823
-
4824
- compile = Sizzle.compile = function( selector, context, xml ) {
4825
- var group, i, len,
4826
- cached = compilerCache[ expando ][ selector ];
4827
-
4828
- // Return a cached group function if already generated (context dependent)
4829
- if ( cached && cached.context === context ) {
4830
- return cached;
4831
- }
4832
-
4833
- // Generate a function of recursive functions that can be used to check each element
4834
- group = tokenize( selector, context, xml );
4835
- for ( i = 0, len = group.length; i < len; i++ ) {
4836
- group[i] = matcherFromTokens(group[i], context, xml);
4837
- }
4838
-
4839
- // Cache the compiled function
4840
- cached = compilerCache( selector, matcherFromGroupMatchers(group) );
4841
- cached.context = context;
4842
- cached.runs = cached.dirruns = 0;
4843
- return cached;
4844
- };
4845
-
4846
- function multipleContexts( selector, contexts, results, seed ) {
4847
- var i = 0,
4848
- len = contexts.length;
4849
- for ( ; i < len; i++ ) {
4850
- Sizzle( selector, contexts[i], results, seed );
4851
- }
4852
- }
4853
-
4854
- function handlePOSGroup( selector, posfilter, argument, contexts, seed, not ) {
4855
- var results,
4856
- fn = Expr.setFilters[ posfilter.toLowerCase() ];
4857
-
4858
- if ( !fn ) {
4859
- Sizzle.error( posfilter );
4860
- }
4861
-
4862
- if ( selector || !(results = seed) ) {
4863
- multipleContexts( selector || "*", contexts, (results = []), seed );
4864
- }
4865
-
4866
- return results.length > 0 ? fn( results, argument, not ) : [];
4867
- }
4868
-
4869
- function handlePOS( groups, context, results, seed ) {
4870
- var group, part, j, groupLen, token, selector,
4871
- anchor, elements, match, matched,
4872
- lastIndex, currentContexts, not,
4873
- i = 0,
4874
- len = groups.length,
4875
- rpos = matchExpr["POS"],
4876
- // This is generated here in case matchExpr["POS"] is extended
4877
- rposgroups = new RegExp( "^" + rpos.source + "(?!" + whitespace + ")", "i" ),
4878
- // This is for making sure non-participating
4879
- // matching groups are represented cross-browser (IE6-8)
4880
- setUndefined = function() {
4881
- var i = 1,
4882
- len = arguments.length - 2;
4883
- for ( ; i < len; i++ ) {
4884
- if ( arguments[i] === undefined ) {
4885
- match[i] = undefined;
4886
- }
4887
- }
4888
- };
4889
-
4890
- for ( ; i < len; i++ ) {
4891
- group = groups[i];
4892
- part = "";
4893
- elements = seed;
4894
- for ( j = 0, groupLen = group.length; j < groupLen; j++ ) {
4895
- token = group[j];
4896
- selector = token.string;
4897
- if ( token.part === "PSEUDO" ) {
4898
- // Reset regex index to 0
4899
- rpos.exec("");
4900
- anchor = 0;
4901
- while ( (match = rpos.exec( selector )) ) {
4902
- matched = true;
4903
- lastIndex = rpos.lastIndex = match.index + match[0].length;
4904
- if ( lastIndex > anchor ) {
4905
- part += selector.slice( anchor, match.index );
4906
- anchor = lastIndex;
4907
- currentContexts = [ context ];
4908
-
4909
- if ( rcombinators.test(part) ) {
4910
- if ( elements ) {
4911
- currentContexts = elements;
4912
- }
4913
- elements = seed;
4914
- }
4915
-
4916
- if ( (not = rendsWithNot.test( part )) ) {
4917
- part = part.slice( 0, -5 ).replace( rcombinators, "$&*" );
4918
- anchor++;
4919
- }
4920
-
4921
- if ( match.length > 1 ) {
4922
- match[0].replace( rposgroups, setUndefined );
4923
- }
4924
- elements = handlePOSGroup( part, match[1], match[2], currentContexts, elements, not );
4925
- }
4926
- part = "";
4927
- }
4928
-
4929
- }
4930
-
4931
- if ( !matched ) {
4932
- part += selector;
4933
- }
4934
- matched = false;
4935
- }
4936
-
4937
- if ( part ) {
4938
- if ( rcombinators.test(part) ) {
4939
- multipleContexts( part, elements || [ context ], results, seed );
4940
- } else {
4941
- Sizzle( part, context, results, seed ? seed.concat(elements) : elements );
4942
- }
4943
- } else {
4944
- push.apply( results, elements );
4945
- }
4946
- }
4947
-
4948
- // Do not sort if this is a single filter
4949
- return len === 1 ? results : Sizzle.uniqueSort( results );
4950
- }
4951
-
4952
- function select( selector, context, results, seed, xml ) {
4953
- // Remove excessive whitespace
4954
- selector = selector.replace( rtrim, "$1" );
4955
- var elements, matcher, cached, elem,
4956
- i, tokens, token, lastToken, findContext, type,
4957
- match = tokenize( selector, context, xml ),
4958
- contextNodeType = context.nodeType;
4959
-
4960
- // POS handling
4961
- if ( matchExpr["POS"].test(selector) ) {
4962
- return handlePOS( match, context, results, seed );
4963
- }
4964
-
4965
- if ( seed ) {
4966
- elements = slice.call( seed, 0 );
4967
-
4968
- // To maintain document order, only narrow the
4969
- // set if there is one group
4970
- } else if ( match.length === 1 ) {
4971
-
4972
- // Take a shortcut and set the context if the root selector is an ID
4973
- if ( (tokens = slice.call( match[0], 0 )).length > 2 &&
4974
- (token = tokens[0]).part === "ID" &&
4975
- contextNodeType === 9 && !xml &&
4976
- Expr.relative[ tokens[1].part ] ) {
4977
-
4978
- context = Expr.find["ID"]( token.captures[0].replace( rbackslash, "" ), context, xml )[0];
4979
- if ( !context ) {
4980
- return results;
4981
- }
4982
-
4983
- selector = selector.slice( tokens.shift().string.length );
4984
- }
4985
-
4986
- findContext = ( (match = rsibling.exec( tokens[0].string )) && !match.index && context.parentNode ) || context;
4987
-
4988
- // Reduce the set if possible
4989
- lastToken = "";
4990
- for ( i = tokens.length - 1; i >= 0; i-- ) {
4991
- token = tokens[i];
4992
- type = token.part;
4993
- lastToken = token.string + lastToken;
4994
- if ( Expr.relative[ type ] ) {
4995
- break;
4996
- }
4997
- if ( Expr.order.test(type) ) {
4998
- elements = Expr.find[ type ]( token.captures[0].replace( rbackslash, "" ), findContext, xml );
4999
- if ( elements == null ) {
5000
- continue;
5001
- } else {
5002
- selector = selector.slice( 0, selector.length - lastToken.length ) +
5003
- lastToken.replace( matchExpr[ type ], "" );
5004
-
5005
- if ( !selector ) {
5006
- push.apply( results, slice.call(elements, 0) );
5007
- }
5008
-
5009
- break;
5010
- }
5011
- }
5012
- }
5013
- }
5014
-
5015
- // Only loop over the given elements once
5016
- if ( selector ) {
5017
- matcher = compile( selector, context, xml );
5018
- dirruns = matcher.dirruns++;
5019
- if ( elements == null ) {
5020
- elements = Expr.find["TAG"]( "*", (rsibling.test( selector ) && context.parentNode) || context );
5021
- }
5022
-
5023
- for ( i = 0; (elem = elements[i]); i++ ) {
5024
- cachedruns = matcher.runs++;
5025
- if ( matcher(elem) ) {
5026
- results.push( elem );
5027
- }
5028
- }
5029
- }
5030
-
5031
- return results;
5032
- }
5033
-
5034
- if ( document.querySelectorAll ) {
5035
- (function() {
5036
- var disconnectedMatch,
5037
- oldSelect = select,
5038
- rescape = /'|\\/g,
5039
- rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
5040
- rbuggyQSA = [],
5041
- // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
5042
- // A support test would require too much code (would include document ready)
5043
- // just skip matchesSelector for :active
5044
- rbuggyMatches = [":active"],
5045
- matches = docElem.matchesSelector ||
5046
- docElem.mozMatchesSelector ||
5047
- docElem.webkitMatchesSelector ||
5048
- docElem.oMatchesSelector ||
5049
- docElem.msMatchesSelector;
5050
-
5051
- // Build QSA regex
5052
- // Regex strategy adopted from Diego Perini
5053
- assert(function( div ) {
5054
- // Select is set to empty string on purpose
5055
- // This is to test IE's treatment of not explictly
5056
- // setting a boolean content attribute,
5057
- // since its presence should be enough
5058
- // http://bugs.jquery.com/ticket/12359
5059
- div.innerHTML = "<select><option selected=''></option></select>";
5060
-
5061
- // IE8 - Some boolean attributes are not treated correctly
5062
- if ( !div.querySelectorAll("[selected]").length ) {
5063
- rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
5064
- }
5065
-
5066
- // Webkit/Opera - :checked should return selected option elements
5067
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
5068
- // IE8 throws error here (do not put tests after this one)
5069
- if ( !div.querySelectorAll(":checked").length ) {
5070
- rbuggyQSA.push(":checked");
5071
- }
5072
- });
5073
-
5074
- assert(function( div ) {
5075
-
5076
- // Opera 10-12/IE9 - ^= $= *= and empty values
5077
- // Should not select anything
5078
- div.innerHTML = "<p test=''></p>";
5079
- if ( div.querySelectorAll("[test^='']").length ) {
5080
- rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
5081
- }
5082
-
5083
- // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
5084
- // IE8 throws error here (do not put tests after this one)
5085
- div.innerHTML = "<input type='hidden'/>";
5086
- if ( !div.querySelectorAll(":enabled").length ) {
5087
- rbuggyQSA.push(":enabled", ":disabled");
5088
- }
5089
- });
5090
-
5091
- rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
5092
-
5093
- select = function( selector, context, results, seed, xml ) {
5094
- // Only use querySelectorAll when not filtering,
5095
- // when this is not xml,
5096
- // and when no QSA bugs apply
5097
- if ( !seed && !xml && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
5098
- if ( context.nodeType === 9 ) {
5099
- try {
5100
- push.apply( results, slice.call(context.querySelectorAll( selector ), 0) );
5101
- return results;
5102
- } catch(qsaError) {}
5103
- // qSA works strangely on Element-rooted queries
5104
- // We can work around this by specifying an extra ID on the root
5105
- // and working up from there (Thanks to Andrew Dupont for the technique)
5106
- // IE 8 doesn't work on object elements
5107
- } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
5108
- var groups, i, len,
5109
- old = context.getAttribute("id"),
5110
- nid = old || expando,
5111
- newContext = rsibling.test( selector ) && context.parentNode || context;
5112
-
5113
- if ( old ) {
5114
- nid = nid.replace( rescape, "\\$&" );
5115
- } else {
5116
- context.setAttribute( "id", nid );
5117
- }
5118
-
5119
- groups = tokenize(selector, context, xml);
5120
- // Trailing space is unnecessary
5121
- // There is always a context check
5122
- nid = "[id='" + nid + "']";
5123
- for ( i = 0, len = groups.length; i < len; i++ ) {
5124
- groups[i] = nid + groups[i].selector;
5125
- }
5126
- try {
5127
- push.apply( results, slice.call( newContext.querySelectorAll(
5128
- groups.join(",")
5129
- ), 0 ) );
5130
- return results;
5131
- } catch(qsaError) {
5132
- } finally {
5133
- if ( !old ) {
5134
- context.removeAttribute("id");
5135
- }
5136
- }
5137
- }
5138
- }
5139
-
5140
- return oldSelect( selector, context, results, seed, xml );
5141
- };
5142
-
5143
- if ( matches ) {
5144
- assert(function( div ) {
5145
- // Check to see if it's possible to do matchesSelector
5146
- // on a disconnected node (IE 9)
5147
- disconnectedMatch = matches.call( div, "div" );
5148
-
5149
- // This should fail with an exception
5150
- // Gecko does not error, returns false instead
5151
- try {
5152
- matches.call( div, "[test!='']:sizzle" );
5153
- rbuggyMatches.push( matchExpr["PSEUDO"].source, matchExpr["POS"].source, "!=" );
5154
- } catch ( e ) {}
5155
- });
5156
-
5157
- // rbuggyMatches always contains :active, so no need for a length check
5158
- rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );
5159
-
5160
- Sizzle.matchesSelector = function( elem, expr ) {
5161
- // Make sure that attribute selectors are quoted
5162
- expr = expr.replace( rattributeQuotes, "='$1']" );
5163
-
5164
- // rbuggyMatches always contains :active, so no need for an existence check
5165
- if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && (!rbuggyQSA || !rbuggyQSA.test( expr )) ) {
5166
- try {
5167
- var ret = matches.call( elem, expr );
5168
-
5169
- // IE 9's matchesSelector returns false on disconnected nodes
5170
- if ( ret || disconnectedMatch ||
5171
- // As well, disconnected nodes are said to be in a document
5172
- // fragment in IE 9
5173
- elem.document && elem.document.nodeType !== 11 ) {
5174
- return ret;
5175
- }
5176
- } catch(e) {}
5177
- }
5178
-
5179
- return Sizzle( expr, null, null, [ elem ] ).length > 0;
5180
- };
5181
- }
5182
- })();
5183
- }
5184
-
5185
- // Deprecated
5186
- Expr.setFilters["nth"] = Expr.setFilters["eq"];
5187
-
5188
- // Back-compat
5189
- Expr.filters = Expr.pseudos;
5190
-
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
+ }
5020
+
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
+ }
5028
+ }
5029
+ }
5030
+
5031
+ // Discard index placeholder values to get only actual matches
5032
+ setMatched = condense( setMatched );
5033
+ }
5034
+
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
+ }
5045
+
5046
+ // Override manipulation of globals by nested matchers
5047
+ if ( outermost ) {
5048
+ dirruns = dirrunsUnique;
5049
+ outermostContext = contextBackup;
5050
+ }
5051
+
5052
+ return unmatched;
5053
+ };
5054
+
5055
+ superMatcher.el = 0;
5056
+ return bySet ?
5057
+ markFunction( superMatcher ) :
5058
+ superMatcher;
5059
+ }
5060
+
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
+ }
5080
+ }
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;
5095
+ }
5096
+
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 ) {
5105
+
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 ] ) {
5111
+
5112
+ context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0];
5113
+ if ( !context ) {
5114
+ return results;
5115
+ }
5116
+
5117
+ selector = selector.slice( tokens.shift().length );
5118
+ }
5119
+
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];
5123
+
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
+ }
5143
+
5144
+ break;
5145
+ }
5146
+ }
5147
+ }
5148
+ }
5149
+ }
5150
+
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
+ }
5162
+
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");
5205
+ }
5206
+ });
5207
+
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
+ }
5216
+
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
+ });
5224
+
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 + "'] ";
5252
+
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
+ }
5260
+
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
+ }
5275
+
5276
+ return oldSelect( selector, context, results, seed, xml );
5277
+ };
5278
+
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" );
5284
+
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
+ });
5292
+
5293
+ // rbuggyMatches always contains :active and :focus, so no need for a length check
5294
+ rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );
5295
+
5296
+ Sizzle.matchesSelector = function( elem, expr ) {
5297
+ // Make sure that attribute selectors are quoted
5298
+ expr = expr.replace( rattributeQuotes, "='$1']" );
5299
+
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
+ }
5314
+
5315
+ return Sizzle( expr, null, null, [ elem ] ).length > 0;
5316
+ };
5317
+ }
5318
+ })();
5319
+ }
5320
+
5321
+ // Deprecated
5322
+ Expr.pseudos["nth"] = Expr.pseudos["eq"];
5323
+
5324
+ // Back-compat
5325
+ function setFilters() {}
5326
+ Expr.filters = setFilters.prototype = Expr.pseudos;
5327
+ Expr.setFilters = new setFilters();
5328
+
5191
5329
  // Override sizzle attribute retrieval
5192
5330
  Sizzle.attr = jQuery.attr;
5193
5331
  jQuery.find = Sizzle;
@@ -5197,9 +5335,9 @@ jQuery.unique = Sizzle.uniqueSort;
5197
5335
  jQuery.text = Sizzle.getText;
5198
5336
  jQuery.isXMLDoc = Sizzle.isXML;
5199
5337
  jQuery.contains = Sizzle.contains;
5200
-
5201
-
5202
- })( window );
5338
+
5339
+
5340
+ })( window );
5203
5341
  var runtil = /Until$/,
5204
5342
  rparentsprev = /^(?:parents|prev(?:Until|All))/,
5205
5343
  isSimple = /^.[^:#\[\.,]*$/,
@@ -7123,10 +7261,10 @@ function buildParams( prefix, obj, traditional, add ) {
7123
7261
  add( prefix, obj );
7124
7262
  }
7125
7263
  }
7126
- var // Document location
7127
- ajaxLocation,
7128
- // Document location segments
7264
+ var
7265
+ // Document location
7129
7266
  ajaxLocParts,
7267
+ ajaxLocation,
7130
7268
 
7131
7269
  rhash = /#.*$/,
7132
7270
  rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
@@ -7643,7 +7781,7 @@ jQuery.extend({
7643
7781
 
7644
7782
  // Set data for the fake xhr object
7645
7783
  jqXHR.status = status;
7646
- jqXHR.statusText = "" + ( nativeStatusText || statusText );
7784
+ jqXHR.statusText = ( nativeStatusText || statusText ) + "";
7647
7785
 
7648
7786
  // Success/Error
7649
7787
  if ( isSuccess ) {
@@ -7703,14 +7841,11 @@ jQuery.extend({
7703
7841
  // Extract dataTypes list
7704
7842
  s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace );
7705
7843
 
7706
- // Determine if a cross-domain request is in order
7844
+ // A cross-domain request is in order when we have a protocol:host:port mismatch
7707
7845
  if ( s.crossDomain == null ) {
7708
- parts = rurl.exec( s.url.toLowerCase() );
7709
- s.crossDomain = !!( parts &&
7710
- ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
7711
- ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
7712
- ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
7713
- );
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 ) );
7714
7849
  }
7715
7850
 
7716
7851
  // Convert data if not already a string
@@ -8405,12 +8540,13 @@ var fxNow, timerId,
8405
8540
  animationPrefilters = [ defaultPrefilter ],
8406
8541
  tweeners = {
8407
8542
  "*": [function( prop, value ) {
8408
- var end, unit, prevScale,
8543
+ var end, unit,
8409
8544
  tween = this.createTween( prop, value ),
8410
8545
  parts = rfxnum.exec( value ),
8411
8546
  target = tween.cur(),
8412
8547
  start = +target || 0,
8413
- scale = 1;
8548
+ scale = 1,
8549
+ maxIterations = 20;
8414
8550
 
8415
8551
  if ( parts ) {
8416
8552
  end = +parts[2];
@@ -8426,17 +8562,15 @@ var fxNow, timerId,
8426
8562
  do {
8427
8563
  // If previous iteration zeroed out, double until we get *something*
8428
8564
  // Use a string for doubling factor so we don't accidentally see scale as unchanged below
8429
- prevScale = scale = scale || ".5";
8565
+ scale = scale || ".5";
8430
8566
 
8431
8567
  // Adjust and apply
8432
8568
  start = start / scale;
8433
8569
  jQuery.style( tween.elem, prop, start + unit );
8434
8570
 
8435
- // Update scale, tolerating zeroes from tween.cur()
8436
- scale = tween.cur() / target;
8437
-
8438
- // Stop looping if we've hit the mark or scale is unchanged
8439
- } while ( scale !== 1 && scale !== prevScale );
8571
+ // Update scale, tolerating zero or NaN from tween.cur()
8572
+ // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
8573
+ } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
8440
8574
  }
8441
8575
 
8442
8576
  tween.unit = unit;
@@ -9069,7 +9203,8 @@ jQuery.fn.offset = function( options ) {
9069
9203
  });
9070
9204
  }
9071
9205
 
9072
- var box, docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, top, left,
9206
+ var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft,
9207
+ box = { top: 0, left: 0 },
9073
9208
  elem = this[ 0 ],
9074
9209
  doc = elem && elem.ownerDocument;
9075
9210
 
@@ -9083,21 +9218,25 @@ jQuery.fn.offset = function( options ) {
9083
9218
 
9084
9219
  docElem = doc.documentElement;
9085
9220
 
9086
- // Make sure we're not dealing with a disconnected DOM node
9221
+ // Make sure it's not a disconnected DOM node
9087
9222
  if ( !jQuery.contains( docElem, elem ) ) {
9088
- return { top: 0, left: 0 };
9223
+ return box;
9089
9224
  }
9090
9225
 
9091
- box = elem.getBoundingClientRect();
9226
+ // If we don't have gBCR, just use 0,0 rather than error
9227
+ // BlackBerry 5, iOS 3 (original iPhone)
9228
+ if ( typeof elem.getBoundingClientRect !== "undefined" ) {
9229
+ box = elem.getBoundingClientRect();
9230
+ }
9092
9231
  win = getWindow( doc );
9093
9232
  clientTop = docElem.clientTop || body.clientTop || 0;
9094
9233
  clientLeft = docElem.clientLeft || body.clientLeft || 0;
9095
9234
  scrollTop = win.pageYOffset || docElem.scrollTop;
9096
9235
  scrollLeft = win.pageXOffset || docElem.scrollLeft;
9097
- top = box.top + scrollTop - clientTop;
9098
- left = box.left + scrollLeft - clientLeft;
9099
-
9100
- return { top: top, left: left };
9236
+ return {
9237
+ top: box.top + scrollTop - clientTop,
9238
+ left: box.left + scrollLeft - clientLeft
9239
+ };
9101
9240
  };
9102
9241
 
9103
9242
  jQuery.offset = {