jquery-rails 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jquery-rails might be problematic. Click here for more details.

@@ -1,5 +1,5 @@
1
1
  /*!
2
- * jQuery JavaScript Library v1.7.1
2
+ * jQuery JavaScript Library v1.7.2
3
3
  * http://jquery.com/
4
4
  *
5
5
  * Copyright 2011, John Resig
@@ -11,7 +11,7 @@
11
11
  * Copyright 2011, The Dojo Foundation
12
12
  * Released under the MIT, BSD, and GPL Licenses.
13
13
  *
14
- * Date: Mon Nov 21 21:11:03 2011 -0500
14
+ * Date: Wed Mar 21 12:46:34 2012 -0700
15
15
  */
16
16
  (function( window, undefined ) {
17
17
 
@@ -210,7 +210,7 @@ jQuery.fn = jQuery.prototype = {
210
210
  selector: "",
211
211
 
212
212
  // The current version of jQuery being used
213
- jquery: "1.7.1",
213
+ jquery: "1.7.2",
214
214
 
215
215
  // The default length of a jQuery object is 0
216
216
  length: 0,
@@ -497,9 +497,8 @@ jQuery.extend({
497
497
  return jQuery.type(obj) === "array";
498
498
  },
499
499
 
500
- // A crude way of determining if an object is a window
501
500
  isWindow: function( obj ) {
502
- return obj && typeof obj === "object" && "setInterval" in obj;
501
+ return obj != null && obj == obj.window;
503
502
  },
504
503
 
505
504
  isNumeric: function( obj ) {
@@ -579,6 +578,9 @@ jQuery.extend({
579
578
 
580
579
  // Cross-browser xml parsing
581
580
  parseXML: function( data ) {
581
+ if ( typeof data !== "string" || !data ) {
582
+ return null;
583
+ }
582
584
  var xml, tmp;
583
585
  try {
584
586
  if ( window.DOMParser ) { // Standard
@@ -822,31 +824,55 @@ jQuery.extend({
822
824
 
823
825
  // Mutifunctional method to get and set values to a collection
824
826
  // The value/s can optionally be executed if it's a function
825
- access: function( elems, key, value, exec, fn, pass ) {
826
- var length = elems.length;
827
+ access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
828
+ var exec,
829
+ bulk = key == null,
830
+ i = 0,
831
+ length = elems.length;
827
832
 
828
- // Setting many attributes
829
- if ( typeof key === "object" ) {
830
- for ( var k in key ) {
831
- jQuery.access( elems, k, key[k], exec, fn, value );
833
+ // Sets many values
834
+ if ( key && typeof key === "object" ) {
835
+ for ( i in key ) {
836
+ jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
832
837
  }
833
- return elems;
834
- }
838
+ chainable = 1;
835
839
 
836
- // Setting one attribute
837
- if ( value !== undefined ) {
840
+ // Sets one value
841
+ } else if ( value !== undefined ) {
838
842
  // Optionally, function values get executed if exec is true
839
- exec = !pass && exec && jQuery.isFunction(value);
843
+ exec = pass === undefined && jQuery.isFunction( value );
844
+
845
+ if ( bulk ) {
846
+ // Bulk operations only iterate when executing function values
847
+ if ( exec ) {
848
+ exec = fn;
849
+ fn = function( elem, key, value ) {
850
+ return exec.call( jQuery( elem ), value );
851
+ };
852
+
853
+ // Otherwise they run against the entire set
854
+ } else {
855
+ fn.call( elems, value );
856
+ fn = null;
857
+ }
858
+ }
840
859
 
841
- for ( var i = 0; i < length; i++ ) {
842
- fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
860
+ if ( fn ) {
861
+ for (; i < length; i++ ) {
862
+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
863
+ }
843
864
  }
844
865
 
845
- return elems;
866
+ chainable = 1;
846
867
  }
847
868
 
848
- // Getting an attribute
849
- return length ? fn( elems[0], key ) : undefined;
869
+ return chainable ?
870
+ elems :
871
+
872
+ // Gets
873
+ bulk ?
874
+ fn.call( elems ) :
875
+ length ? fn( elems[0], key ) : emptyGet;
850
876
  },
851
877
 
852
878
  now: function() {
@@ -1005,6 +1031,8 @@ jQuery.Callbacks = function( flags ) {
1005
1031
  stack = [],
1006
1032
  // Last fire value (for non-forgettable lists)
1007
1033
  memory,
1034
+ // Flag to know if list was already fired
1035
+ fired,
1008
1036
  // Flag to know if list is currently firing
1009
1037
  firing,
1010
1038
  // First callback to fire (used internally by add and fireWith)
@@ -1038,6 +1066,7 @@ jQuery.Callbacks = function( flags ) {
1038
1066
  fire = function( context, args ) {
1039
1067
  args = args || [];
1040
1068
  memory = !flags.memory || [ context, args ];
1069
+ fired = true;
1041
1070
  firing = true;
1042
1071
  firingIndex = firingStart || 0;
1043
1072
  firingStart = 0;
@@ -1173,7 +1202,7 @@ jQuery.Callbacks = function( flags ) {
1173
1202
  },
1174
1203
  // To know if the callbacks have already been called at least once
1175
1204
  fired: function() {
1176
- return !!memory;
1205
+ return !!fired;
1177
1206
  }
1178
1207
  };
1179
1208
 
@@ -1336,7 +1365,6 @@ jQuery.support = (function() {
1336
1365
  select,
1337
1366
  opt,
1338
1367
  input,
1339
- marginDiv,
1340
1368
  fragment,
1341
1369
  tds,
1342
1370
  events,
@@ -1419,9 +1447,13 @@ jQuery.support = (function() {
1419
1447
  noCloneEvent: true,
1420
1448
  inlineBlockNeedsLayout: false,
1421
1449
  shrinkWrapBlocks: false,
1422
- reliableMarginRight: true
1450
+ reliableMarginRight: true,
1451
+ pixelMargin: true
1423
1452
  };
1424
1453
 
1454
+ // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead
1455
+ jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat");
1456
+
1425
1457
  // Make sure checked status is properly cloned
1426
1458
  input.checked = true;
1427
1459
  support.noCloneChecked = input.cloneNode( true ).checked;
@@ -1456,6 +1488,10 @@ jQuery.support = (function() {
1456
1488
  support.radioValue = input.value === "t";
1457
1489
 
1458
1490
  input.setAttribute("checked", "checked");
1491
+
1492
+ // #11217 - WebKit loses check when the name is after the checked attribute
1493
+ input.setAttribute( "name", "t" );
1494
+
1459
1495
  div.appendChild( input );
1460
1496
  fragment = document.createDocumentFragment();
1461
1497
  fragment.appendChild( div.lastChild );
@@ -1470,23 +1506,6 @@ jQuery.support = (function() {
1470
1506
  fragment.removeChild( input );
1471
1507
  fragment.appendChild( div );
1472
1508
 
1473
- div.innerHTML = "";
1474
-
1475
- // Check if div with explicit width and no margin-right incorrectly
1476
- // gets computed margin-right based on width of container. For more
1477
- // info see bug #3333
1478
- // Fails in WebKit before Feb 2011 nightlies
1479
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
1480
- if ( window.getComputedStyle ) {
1481
- marginDiv = document.createElement( "div" );
1482
- marginDiv.style.width = "0";
1483
- marginDiv.style.marginRight = "0";
1484
- div.style.width = "2px";
1485
- div.appendChild( marginDiv );
1486
- support.reliableMarginRight =
1487
- ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
1488
- }
1489
-
1490
1509
  // Technique from Juriy Zaytsev
1491
1510
  // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
1492
1511
  // We only care about the case where non-standard event systems
@@ -1494,7 +1513,7 @@ jQuery.support = (function() {
1494
1513
  // avoid an eval call (in setAttribute) which can cause CSP
1495
1514
  // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
1496
1515
  if ( div.attachEvent ) {
1497
- for( i in {
1516
+ for ( i in {
1498
1517
  submit: 1,
1499
1518
  change: 1,
1500
1519
  focusin: 1
@@ -1512,12 +1531,13 @@ jQuery.support = (function() {
1512
1531
  fragment.removeChild( div );
1513
1532
 
1514
1533
  // Null elements to avoid leaks in IE
1515
- fragment = select = opt = marginDiv = div = input = null;
1534
+ fragment = select = opt = div = input = null;
1516
1535
 
1517
1536
  // Run tests that need a body at doc ready
1518
1537
  jQuery(function() {
1519
1538
  var container, outer, inner, table, td, offsetSupport,
1520
- conMarginTop, ptlm, vb, style, html,
1539
+ marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight,
1540
+ paddingMarginBorderVisibility, paddingMarginBorder,
1521
1541
  body = document.getElementsByTagName("body")[0];
1522
1542
 
1523
1543
  if ( !body ) {
@@ -1526,15 +1546,16 @@ jQuery.support = (function() {
1526
1546
  }
1527
1547
 
1528
1548
  conMarginTop = 1;
1529
- ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";
1530
- vb = "visibility:hidden;border:0;";
1531
- style = "style='" + ptlm + "border:5px solid #000;padding:0;'";
1532
- html = "<div " + style + "><div></div></div>" +
1533
- "<table " + style + " cellpadding='0' cellspacing='0'>" +
1549
+ paddingMarginBorder = "padding:0;margin:0;border:";
1550
+ positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;";
1551
+ paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;";
1552
+ style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;";
1553
+ html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" +
1554
+ "<table " + style + "' cellpadding='0' cellspacing='0'>" +
1534
1555
  "<tr><td></td></tr></table>";
1535
1556
 
1536
1557
  container = document.createElement("div");
1537
- container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
1558
+ container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
1538
1559
  body.insertBefore( container, body.firstChild );
1539
1560
 
1540
1561
  // Construct the test element
@@ -1548,7 +1569,7 @@ jQuery.support = (function() {
1548
1569
  // display:none (it is still safe to use offsets if a parent element is
1549
1570
  // hidden; don safety goggles and see bug #4512 for more information).
1550
1571
  // (only IE 8 fails this test)
1551
- div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
1572
+ div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>";
1552
1573
  tds = div.getElementsByTagName( "td" );
1553
1574
  isSupported = ( tds[ 0 ].offsetHeight === 0 );
1554
1575
 
@@ -1559,28 +1580,44 @@ jQuery.support = (function() {
1559
1580
  // (IE <= 8 fail this test)
1560
1581
  support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
1561
1582
 
1562
- // Figure out if the W3C box model works as expected
1563
- div.innerHTML = "";
1564
- div.style.width = div.style.paddingLeft = "1px";
1565
- jQuery.boxModel = support.boxModel = div.offsetWidth === 2;
1583
+ // Check if div with explicit width and no margin-right incorrectly
1584
+ // gets computed margin-right based on width of container. For more
1585
+ // info see bug #3333
1586
+ // Fails in WebKit before Feb 2011 nightlies
1587
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
1588
+ if ( window.getComputedStyle ) {
1589
+ div.innerHTML = "";
1590
+ marginDiv = document.createElement( "div" );
1591
+ marginDiv.style.width = "0";
1592
+ marginDiv.style.marginRight = "0";
1593
+ div.style.width = "2px";
1594
+ div.appendChild( marginDiv );
1595
+ support.reliableMarginRight =
1596
+ ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
1597
+ }
1566
1598
 
1567
1599
  if ( typeof div.style.zoom !== "undefined" ) {
1568
1600
  // Check if natively block-level elements act like inline-block
1569
1601
  // elements when setting their display to 'inline' and giving
1570
1602
  // them layout
1571
1603
  // (IE < 8 does this)
1604
+ div.innerHTML = "";
1605
+ div.style.width = div.style.padding = "1px";
1606
+ div.style.border = 0;
1607
+ div.style.overflow = "hidden";
1572
1608
  div.style.display = "inline";
1573
1609
  div.style.zoom = 1;
1574
- support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
1610
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
1575
1611
 
1576
1612
  // Check if elements with layout shrink-wrap their children
1577
1613
  // (IE 6 does this)
1578
- div.style.display = "";
1579
- div.innerHTML = "<div style='width:4px;'></div>";
1580
- support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
1614
+ div.style.display = "block";
1615
+ div.style.overflow = "visible";
1616
+ div.innerHTML = "<div style='width:5px;'></div>";
1617
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
1581
1618
  }
1582
1619
 
1583
- div.style.cssText = ptlm + vb;
1620
+ div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility;
1584
1621
  div.innerHTML = html;
1585
1622
 
1586
1623
  outer = div.firstChild;
@@ -1605,8 +1642,17 @@ jQuery.support = (function() {
1605
1642
  offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
1606
1643
  offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
1607
1644
 
1645
+ if ( window.getComputedStyle ) {
1646
+ div.style.marginTop = "1%";
1647
+ support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%";
1648
+ }
1649
+
1650
+ if ( typeof container.style.zoom !== "undefined" ) {
1651
+ container.style.zoom = 1;
1652
+ }
1653
+
1608
1654
  body.removeChild( container );
1609
- div = container = null;
1655
+ marginDiv = div = container = null;
1610
1656
 
1611
1657
  jQuery.extend( support, offsetSupport );
1612
1658
  });
@@ -1863,62 +1909,70 @@ jQuery.extend({
1863
1909
 
1864
1910
  jQuery.fn.extend({
1865
1911
  data: function( key, value ) {
1866
- var parts, attr, name,
1912
+ var parts, part, attr, name, l,
1913
+ elem = this[0],
1914
+ i = 0,
1867
1915
  data = null;
1868
1916
 
1869
- if ( typeof key === "undefined" ) {
1917
+ // Gets all values
1918
+ if ( key === undefined ) {
1870
1919
  if ( this.length ) {
1871
- data = jQuery.data( this[0] );
1920
+ data = jQuery.data( elem );
1872
1921
 
1873
- if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) {
1874
- attr = this[0].attributes;
1875
- for ( var i = 0, l = attr.length; i < l; i++ ) {
1922
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
1923
+ attr = elem.attributes;
1924
+ for ( l = attr.length; i < l; i++ ) {
1876
1925
  name = attr[i].name;
1877
1926
 
1878
1927
  if ( name.indexOf( "data-" ) === 0 ) {
1879
1928
  name = jQuery.camelCase( name.substring(5) );
1880
1929
 
1881
- dataAttr( this[0], name, data[ name ] );
1930
+ dataAttr( elem, name, data[ name ] );
1882
1931
  }
1883
1932
  }
1884
- jQuery._data( this[0], "parsedAttrs", true );
1933
+ jQuery._data( elem, "parsedAttrs", true );
1885
1934
  }
1886
1935
  }
1887
1936
 
1888
1937
  return data;
1938
+ }
1889
1939
 
1890
- } else if ( typeof key === "object" ) {
1940
+ // Sets multiple values
1941
+ if ( typeof key === "object" ) {
1891
1942
  return this.each(function() {
1892
1943
  jQuery.data( this, key );
1893
1944
  });
1894
1945
  }
1895
1946
 
1896
- parts = key.split(".");
1947
+ parts = key.split( ".", 2 );
1897
1948
  parts[1] = parts[1] ? "." + parts[1] : "";
1949
+ part = parts[1] + "!";
1898
1950
 
1899
- if ( value === undefined ) {
1900
- data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
1951
+ return jQuery.access( this, function( value ) {
1901
1952
 
1902
- // Try to fetch any internally stored data first
1903
- if ( data === undefined && this.length ) {
1904
- data = jQuery.data( this[0], key );
1905
- data = dataAttr( this[0], key, data );
1906
- }
1953
+ if ( value === undefined ) {
1954
+ data = this.triggerHandler( "getData" + part, [ parts[0] ] );
1907
1955
 
1908
- return data === undefined && parts[1] ?
1909
- this.data( parts[0] ) :
1910
- data;
1956
+ // Try to fetch any internally stored data first
1957
+ if ( data === undefined && elem ) {
1958
+ data = jQuery.data( elem, key );
1959
+ data = dataAttr( elem, key, data );
1960
+ }
1911
1961
 
1912
- } else {
1913
- return this.each(function() {
1914
- var self = jQuery( this ),
1915
- args = [ parts[0], value ];
1962
+ return data === undefined && parts[1] ?
1963
+ this.data( parts[0] ) :
1964
+ data;
1965
+ }
1916
1966
 
1917
- self.triggerHandler( "setData" + parts[1] + "!", args );
1967
+ parts[1] = value;
1968
+ this.each(function() {
1969
+ var self = jQuery( this );
1970
+
1971
+ self.triggerHandler( "setData" + part, parts );
1918
1972
  jQuery.data( this, key, value );
1919
- self.triggerHandler( "changeData" + parts[1] + "!", args );
1973
+ self.triggerHandler( "changeData" + part, parts );
1920
1974
  });
1921
- }
1975
+ }, null, value, arguments.length > 1, null, false );
1922
1976
  },
1923
1977
 
1924
1978
  removeData: function( key ) {
@@ -1942,7 +1996,7 @@ function dataAttr( elem, key, data ) {
1942
1996
  data = data === "true" ? true :
1943
1997
  data === "false" ? false :
1944
1998
  data === "null" ? null :
1945
- jQuery.isNumeric( data ) ? parseFloat( data ) :
1999
+ jQuery.isNumeric( data ) ? +data :
1946
2000
  rbrace.test( data ) ? jQuery.parseJSON( data ) :
1947
2001
  data;
1948
2002
  } catch( e ) {}
@@ -2077,21 +2131,27 @@ jQuery.extend({
2077
2131
 
2078
2132
  jQuery.fn.extend({
2079
2133
  queue: function( type, data ) {
2134
+ var setter = 2;
2135
+
2080
2136
  if ( typeof type !== "string" ) {
2081
2137
  data = type;
2082
2138
  type = "fx";
2139
+ setter--;
2083
2140
  }
2084
2141
 
2085
- if ( data === undefined ) {
2142
+ if ( arguments.length < setter ) {
2086
2143
  return jQuery.queue( this[0], type );
2087
2144
  }
2088
- return this.each(function() {
2089
- var queue = jQuery.queue( this, type, data );
2090
2145
 
2091
- if ( type === "fx" && queue[0] !== "inprogress" ) {
2092
- jQuery.dequeue( this, type );
2093
- }
2094
- });
2146
+ return data === undefined ?
2147
+ this :
2148
+ this.each(function() {
2149
+ var queue = jQuery.queue( this, type, data );
2150
+
2151
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
2152
+ jQuery.dequeue( this, type );
2153
+ }
2154
+ });
2095
2155
  },
2096
2156
  dequeue: function( type ) {
2097
2157
  return this.each(function() {
@@ -2145,7 +2205,7 @@ jQuery.fn.extend({
2145
2205
  }
2146
2206
  }
2147
2207
  resolve();
2148
- return defer.promise();
2208
+ return defer.promise( object );
2149
2209
  }
2150
2210
  });
2151
2211
 
@@ -2164,7 +2224,7 @@ var rclass = /[\n\t\r]/g,
2164
2224
 
2165
2225
  jQuery.fn.extend({
2166
2226
  attr: function( name, value ) {
2167
- return jQuery.access( this, name, value, true, jQuery.attr );
2227
+ return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
2168
2228
  },
2169
2229
 
2170
2230
  removeAttr: function( name ) {
@@ -2174,7 +2234,7 @@ jQuery.fn.extend({
2174
2234
  },
2175
2235
 
2176
2236
  prop: function( name, value ) {
2177
- return jQuery.access( this, name, value, true, jQuery.prop );
2237
+ return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
2178
2238
  },
2179
2239
 
2180
2240
  removeProp: function( name ) {
@@ -2314,7 +2374,7 @@ jQuery.fn.extend({
2314
2374
 
2315
2375
  if ( !arguments.length ) {
2316
2376
  if ( elem ) {
2317
- hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
2377
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
2318
2378
 
2319
2379
  if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
2320
2380
  return ret;
@@ -2358,7 +2418,7 @@ jQuery.fn.extend({
2358
2418
  });
2359
2419
  }
2360
2420
 
2361
- hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
2421
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
2362
2422
 
2363
2423
  // If set returns undefined, fall back to normal setting
2364
2424
  if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
@@ -2504,7 +2564,7 @@ jQuery.extend({
2504
2564
  },
2505
2565
 
2506
2566
  removeAttr: function( elem, value ) {
2507
- var propName, attrNames, name, l,
2567
+ var propName, attrNames, name, l, isBool,
2508
2568
  i = 0;
2509
2569
 
2510
2570
  if ( value && elem.nodeType === 1 ) {
@@ -2516,13 +2576,17 @@ jQuery.extend({
2516
2576
 
2517
2577
  if ( name ) {
2518
2578
  propName = jQuery.propFix[ name ] || name;
2579
+ isBool = rboolean.test( name );
2519
2580
 
2520
2581
  // See #9699 for explanation of this approach (setting first, then removal)
2521
- jQuery.attr( elem, name, "" );
2582
+ // Do not do this for boolean attributes (see #10870)
2583
+ if ( !isBool ) {
2584
+ jQuery.attr( elem, name, "" );
2585
+ }
2522
2586
  elem.removeAttribute( getSetAttribute ? name : propName );
2523
2587
 
2524
2588
  // Set corresponding property to false for boolean attributes
2525
- if ( rboolean.test( name ) && propName in elem ) {
2589
+ if ( isBool && propName in elem ) {
2526
2590
  elem[ propName ] = false;
2527
2591
  }
2528
2592
  }
@@ -2676,7 +2740,8 @@ if ( !getSetAttribute ) {
2676
2740
 
2677
2741
  fixSpecified = {
2678
2742
  name: true,
2679
- id: true
2743
+ id: true,
2744
+ coords: true
2680
2745
  };
2681
2746
 
2682
2747
  // Use this for any attribute in IE6/7
@@ -2806,7 +2871,7 @@ jQuery.each([ "radio", "checkbox" ], function() {
2806
2871
 
2807
2872
  var rformElems = /^(?:textarea|input|select)$/i,
2808
2873
  rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
2809
- rhoverHack = /\bhover(\.\S+)?\b/,
2874
+ rhoverHack = /(?:^|\s)hover(\.\S+)?\b/,
2810
2875
  rkeyEvent = /^key/,
2811
2876
  rmouseEvent = /^(?:mouse|contextmenu)|click/,
2812
2877
  rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
@@ -2854,6 +2919,7 @@ jQuery.event = {
2854
2919
  if ( handler.handler ) {
2855
2920
  handleObjIn = handler;
2856
2921
  handler = handleObjIn.handler;
2922
+ selector = handleObjIn.selector;
2857
2923
  }
2858
2924
 
2859
2925
  // Make sure that the handler has a unique ID, used to find/remove it later
@@ -2905,7 +2971,7 @@ jQuery.event = {
2905
2971
  handler: handler,
2906
2972
  guid: handler.guid,
2907
2973
  selector: selector,
2908
- quick: quickParse( selector ),
2974
+ quick: selector && quickParse( selector ),
2909
2975
  namespace: namespaces.join(".")
2910
2976
  }, handleObjIn );
2911
2977
 
@@ -3194,6 +3260,7 @@ jQuery.event = {
3194
3260
  delegateCount = handlers.delegateCount,
3195
3261
  args = [].slice.call( arguments, 0 ),
3196
3262
  run_all = !event.exclusive && !event.namespace,
3263
+ special = jQuery.event.special[ event.type ] || {},
3197
3264
  handlerQueue = [],
3198
3265
  i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
3199
3266
 
@@ -3201,34 +3268,43 @@ jQuery.event = {
3201
3268
  args[0] = event;
3202
3269
  event.delegateTarget = this;
3203
3270
 
3271
+ // Call the preDispatch hook for the mapped type, and let it bail if desired
3272
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
3273
+ return;
3274
+ }
3275
+
3204
3276
  // Determine handlers that should run if there are delegated events
3205
- // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861)
3206
- if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) {
3277
+ // Avoid non-left-click bubbling in Firefox (#3861)
3278
+ if ( delegateCount && !(event.button && event.type === "click") ) {
3207
3279
 
3208
3280
  // Pregenerate a single jQuery object for reuse with .is()
3209
3281
  jqcur = jQuery(this);
3210
3282
  jqcur.context = this.ownerDocument || this;
3211
3283
 
3212
3284
  for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
3213
- selMatch = {};
3214
- matches = [];
3215
- jqcur[0] = cur;
3216
- for ( i = 0; i < delegateCount; i++ ) {
3217
- handleObj = handlers[ i ];
3218
- sel = handleObj.selector;
3219
-
3220
- if ( selMatch[ sel ] === undefined ) {
3221
- selMatch[ sel ] = (
3222
- handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
3223
- );
3285
+
3286
+ // Don't process events on disabled elements (#6911, #8165)
3287
+ if ( cur.disabled !== true ) {
3288
+ selMatch = {};
3289
+ matches = [];
3290
+ jqcur[0] = cur;
3291
+ for ( i = 0; i < delegateCount; i++ ) {
3292
+ handleObj = handlers[ i ];
3293
+ sel = handleObj.selector;
3294
+
3295
+ if ( selMatch[ sel ] === undefined ) {
3296
+ selMatch[ sel ] = (
3297
+ handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
3298
+ );
3299
+ }
3300
+ if ( selMatch[ sel ] ) {
3301
+ matches.push( handleObj );
3302
+ }
3224
3303
  }
3225
- if ( selMatch[ sel ] ) {
3226
- matches.push( handleObj );
3304
+ if ( matches.length ) {
3305
+ handlerQueue.push({ elem: cur, matches: matches });
3227
3306
  }
3228
3307
  }
3229
- if ( matches.length ) {
3230
- handlerQueue.push({ elem: cur, matches: matches });
3231
- }
3232
3308
  }
3233
3309
  }
3234
3310
 
@@ -3266,6 +3342,11 @@ jQuery.event = {
3266
3342
  }
3267
3343
  }
3268
3344
 
3345
+ // Call the postDispatch hook for the mapped type
3346
+ if ( special.postDispatch ) {
3347
+ special.postDispatch.call( this, event );
3348
+ }
3349
+
3269
3350
  return event.result;
3270
3351
  },
3271
3352
 
@@ -3557,16 +3638,23 @@ if ( !jQuery.support.submitBubbles ) {
3557
3638
  form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
3558
3639
  if ( form && !form._submit_attached ) {
3559
3640
  jQuery.event.add( form, "submit._submit", function( event ) {
3560
- // If form was submitted by the user, bubble the event up the tree
3561
- if ( this.parentNode && !event.isTrigger ) {
3562
- jQuery.event.simulate( "submit", this.parentNode, event, true );
3563
- }
3641
+ event._submit_bubble = true;
3564
3642
  });
3565
3643
  form._submit_attached = true;
3566
3644
  }
3567
3645
  });
3568
3646
  // return undefined since we don't need an event listener
3569
3647
  },
3648
+
3649
+ postDispatch: function( event ) {
3650
+ // If form was submitted by the user, bubble the event up the tree
3651
+ if ( event._submit_bubble ) {
3652
+ delete event._submit_bubble;
3653
+ if ( this.parentNode && !event.isTrigger ) {
3654
+ jQuery.event.simulate( "submit", this.parentNode, event, true );
3655
+ }
3656
+ }
3657
+ },
3570
3658
 
3571
3659
  teardown: function() {
3572
3660
  // Only need this for delegated form submit events
@@ -3671,9 +3759,9 @@ jQuery.fn.extend({
3671
3759
  // Types can be a map of types/handlers
3672
3760
  if ( typeof types === "object" ) {
3673
3761
  // ( types-Object, selector, data )
3674
- if ( typeof selector !== "string" ) {
3762
+ if ( typeof selector !== "string" ) { // && selector != null
3675
3763
  // ( types-Object, data )
3676
- data = selector;
3764
+ data = data || selector;
3677
3765
  selector = undefined;
3678
3766
  }
3679
3767
  for ( type in types ) {
@@ -3719,14 +3807,14 @@ jQuery.fn.extend({
3719
3807
  });
3720
3808
  },
3721
3809
  one: function( types, selector, data, fn ) {
3722
- return this.on.call( this, types, selector, data, fn, 1 );
3810
+ return this.on( types, selector, data, fn, 1 );
3723
3811
  },
3724
3812
  off: function( types, selector, fn ) {
3725
3813
  if ( types && types.preventDefault && types.handleObj ) {
3726
3814
  // ( event ) dispatched jQuery.Event
3727
3815
  var handleObj = types.handleObj;
3728
3816
  jQuery( types.delegateTarget ).off(
3729
- handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type,
3817
+ handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
3730
3818
  handleObj.selector,
3731
3819
  handleObj.handler
3732
3820
  );
@@ -3885,7 +3973,7 @@ var Sizzle = function( selector, context, results, seed ) {
3885
3973
  if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
3886
3974
  return [];
3887
3975
  }
3888
-
3976
+
3889
3977
  if ( !selector || typeof selector !== "string" ) {
3890
3978
  return results;
3891
3979
  }
@@ -3895,7 +3983,7 @@ var Sizzle = function( selector, context, results, seed ) {
3895
3983
  contextXML = Sizzle.isXML( context ),
3896
3984
  parts = [],
3897
3985
  soFar = selector;
3898
-
3986
+
3899
3987
  // Reset the position of the chunker regexp (start from head)
3900
3988
  do {
3901
3989
  chunker.exec( "" );
@@ -3903,9 +3991,9 @@ var Sizzle = function( selector, context, results, seed ) {
3903
3991
 
3904
3992
  if ( m ) {
3905
3993
  soFar = m[3];
3906
-
3994
+
3907
3995
  parts.push( m[1] );
3908
-
3996
+
3909
3997
  if ( m[2] ) {
3910
3998
  extra = m[3];
3911
3999
  break;
@@ -3929,7 +4017,7 @@ var Sizzle = function( selector, context, results, seed ) {
3929
4017
  if ( Expr.relative[ selector ] ) {
3930
4018
  selector += parts.shift();
3931
4019
  }
3932
-
4020
+
3933
4021
  set = posProcess( selector, set, seed );
3934
4022
  }
3935
4023
  }
@@ -4057,7 +4145,7 @@ Sizzle.find = function( expr, context, isXML ) {
4057
4145
 
4058
4146
  for ( i = 0, len = Expr.order.length; i < len; i++ ) {
4059
4147
  type = Expr.order[i];
4060
-
4148
+
4061
4149
  if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
4062
4150
  left = match[1];
4063
4151
  match.splice( 1, 1 );
@@ -4189,7 +4277,7 @@ var getText = Sizzle.getText = function( elem ) {
4189
4277
  ret = "";
4190
4278
 
4191
4279
  if ( nodeType ) {
4192
- if ( nodeType === 1 || nodeType === 9 ) {
4280
+ if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
4193
4281
  // Use textContent || innerText for elements
4194
4282
  if ( typeof elem.textContent === 'string' ) {
4195
4283
  return elem.textContent;
@@ -4429,7 +4517,7 @@ var Expr = Sizzle.selectors = {
4429
4517
 
4430
4518
  ATTR: function( match, curLoop, inplace, result, not, isXML ) {
4431
4519
  var name = match[1] = match[1].replace( rBackslash, "" );
4432
-
4520
+
4433
4521
  if ( !isXML && Expr.attrMap[name] ) {
4434
4522
  match[1] = Expr.attrMap[name];
4435
4523
  }
@@ -4463,7 +4551,7 @@ var Expr = Sizzle.selectors = {
4463
4551
  } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
4464
4552
  return true;
4465
4553
  }
4466
-
4554
+
4467
4555
  return match;
4468
4556
  },
4469
4557
 
@@ -4473,7 +4561,7 @@ var Expr = Sizzle.selectors = {
4473
4561
  return match;
4474
4562
  }
4475
4563
  },
4476
-
4564
+
4477
4565
  filters: {
4478
4566
  enabled: function( elem ) {
4479
4567
  return elem.disabled === false && elem.type !== "hidden";
@@ -4486,14 +4574,14 @@ var Expr = Sizzle.selectors = {
4486
4574
  checked: function( elem ) {
4487
4575
  return elem.checked === true;
4488
4576
  },
4489
-
4577
+
4490
4578
  selected: function( elem ) {
4491
4579
  // Accessing this property makes selected-by-default
4492
4580
  // options in Safari work properly
4493
4581
  if ( elem.parentNode ) {
4494
4582
  elem.parentNode.selectedIndex;
4495
4583
  }
4496
-
4584
+
4497
4585
  return elem.selected === true;
4498
4586
  },
4499
4587
 
@@ -4515,7 +4603,7 @@ var Expr = Sizzle.selectors = {
4515
4603
 
4516
4604
  text: function( elem ) {
4517
4605
  var attr = elem.getAttribute( "type" ), type = elem.type;
4518
- // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
4606
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
4519
4607
  // use getAttribute instead to test this case
4520
4608
  return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
4521
4609
  },
@@ -4633,22 +4721,23 @@ var Expr = Sizzle.selectors = {
4633
4721
  switch ( type ) {
4634
4722
  case "only":
4635
4723
  case "first":
4636
- while ( (node = node.previousSibling) ) {
4637
- if ( node.nodeType === 1 ) {
4638
- return false;
4724
+ while ( (node = node.previousSibling) ) {
4725
+ if ( node.nodeType === 1 ) {
4726
+ return false;
4639
4727
  }
4640
4728
  }
4641
4729
 
4642
- if ( type === "first" ) {
4643
- return true;
4730
+ if ( type === "first" ) {
4731
+ return true;
4644
4732
  }
4645
4733
 
4646
4734
  node = elem;
4647
4735
 
4736
+ /* falls through */
4648
4737
  case "last":
4649
- while ( (node = node.nextSibling) ) {
4650
- if ( node.nodeType === 1 ) {
4651
- return false;
4738
+ while ( (node = node.nextSibling) ) {
4739
+ if ( node.nodeType === 1 ) {
4740
+ return false;
4652
4741
  }
4653
4742
  }
4654
4743
 
@@ -4661,22 +4750,22 @@ var Expr = Sizzle.selectors = {
4661
4750
  if ( first === 1 && last === 0 ) {
4662
4751
  return true;
4663
4752
  }
4664
-
4753
+
4665
4754
  doneName = match[0];
4666
4755
  parent = elem.parentNode;
4667
-
4756
+
4668
4757
  if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
4669
4758
  count = 0;
4670
-
4759
+
4671
4760
  for ( node = parent.firstChild; node; node = node.nextSibling ) {
4672
4761
  if ( node.nodeType === 1 ) {
4673
4762
  node.nodeIndex = ++count;
4674
4763
  }
4675
- }
4764
+ }
4676
4765
 
4677
4766
  parent[ expando ] = doneName;
4678
4767
  }
4679
-
4768
+
4680
4769
  diff = elem.nodeIndex - last;
4681
4770
 
4682
4771
  if ( first === 0 ) {
@@ -4695,7 +4784,7 @@ var Expr = Sizzle.selectors = {
4695
4784
  TAG: function( elem, match ) {
4696
4785
  return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
4697
4786
  },
4698
-
4787
+
4699
4788
  CLASS: function( elem, match ) {
4700
4789
  return (" " + (elem.className || elem.getAttribute("class")) + " ")
4701
4790
  .indexOf( match ) > -1;
@@ -4757,6 +4846,9 @@ for ( var type in Expr.match ) {
4757
4846
  Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
4758
4847
  Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
4759
4848
  }
4849
+ // Expose origPOS
4850
+ // "global" as in regardless of relation to brackets/parens
4851
+ Expr.match.globalPOS = origPOS;
4760
4852
 
4761
4853
  var makeArray = function( array, results ) {
4762
4854
  array = Array.prototype.slice.call( array, 0 );
@@ -4765,7 +4857,7 @@ var makeArray = function( array, results ) {
4765
4857
  results.push.apply( results, array );
4766
4858
  return results;
4767
4859
  }
4768
-
4860
+
4769
4861
  return array;
4770
4862
  };
4771
4863
 
@@ -4997,7 +5089,7 @@ if ( document.querySelectorAll ) {
4997
5089
  if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
4998
5090
  return;
4999
5091
  }
5000
-
5092
+
5001
5093
  Sizzle = function( query, context, extra, seed ) {
5002
5094
  context = context || document;
5003
5095
 
@@ -5006,24 +5098,24 @@ if ( document.querySelectorAll ) {
5006
5098
  if ( !seed && !Sizzle.isXML(context) ) {
5007
5099
  // See if we find a selector to speed up
5008
5100
  var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
5009
-
5101
+
5010
5102
  if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
5011
5103
  // Speed-up: Sizzle("TAG")
5012
5104
  if ( match[1] ) {
5013
5105
  return makeArray( context.getElementsByTagName( query ), extra );
5014
-
5106
+
5015
5107
  // Speed-up: Sizzle(".CLASS")
5016
5108
  } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
5017
5109
  return makeArray( context.getElementsByClassName( match[2] ), extra );
5018
5110
  }
5019
5111
  }
5020
-
5112
+
5021
5113
  if ( context.nodeType === 9 ) {
5022
5114
  // Speed-up: Sizzle("body")
5023
5115
  // The body element only exists once, optimize finding it
5024
5116
  if ( query === "body" && context.body ) {
5025
5117
  return makeArray( [ context.body ], extra );
5026
-
5118
+
5027
5119
  // Speed-up: Sizzle("#ID")
5028
5120
  } else if ( match && match[3] ) {
5029
5121
  var elem = context.getElementById( match[3] );
@@ -5036,12 +5128,12 @@ if ( document.querySelectorAll ) {
5036
5128
  if ( elem.id === match[3] ) {
5037
5129
  return makeArray( [ elem ], extra );
5038
5130
  }
5039
-
5131
+
5040
5132
  } else {
5041
5133
  return makeArray( [], extra );
5042
5134
  }
5043
5135
  }
5044
-
5136
+
5045
5137
  try {
5046
5138
  return makeArray( context.querySelectorAll(query), extra );
5047
5139
  } catch(qsaError) {}
@@ -5079,7 +5171,7 @@ if ( document.querySelectorAll ) {
5079
5171
  }
5080
5172
  }
5081
5173
  }
5082
-
5174
+
5083
5175
  return oldSizzle(query, context, extra, seed);
5084
5176
  };
5085
5177
 
@@ -5106,7 +5198,7 @@ if ( document.querySelectorAll ) {
5106
5198
  // This should fail with an exception
5107
5199
  // Gecko does not error, returns false instead
5108
5200
  matches.call( document.documentElement, "[test!='']:sizzle" );
5109
-
5201
+
5110
5202
  } catch( pseudoError ) {
5111
5203
  pseudoWorks = true;
5112
5204
  }
@@ -5116,7 +5208,7 @@ if ( document.querySelectorAll ) {
5116
5208
  expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
5117
5209
 
5118
5210
  if ( !Sizzle.isXML( node ) ) {
5119
- try {
5211
+ try {
5120
5212
  if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
5121
5213
  var ret = matches.call( node, expr );
5122
5214
 
@@ -5153,7 +5245,7 @@ if ( document.querySelectorAll ) {
5153
5245
  if ( div.getElementsByClassName("e").length === 1 ) {
5154
5246
  return;
5155
5247
  }
5156
-
5248
+
5157
5249
  Expr.order.splice(1, 0, "CLASS");
5158
5250
  Expr.find.CLASS = function( match, context, isXML ) {
5159
5251
  if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
@@ -5204,7 +5296,7 @@ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
5204
5296
 
5205
5297
  if ( elem ) {
5206
5298
  var match = false;
5207
-
5299
+
5208
5300
  elem = elem[dir];
5209
5301
 
5210
5302
  while ( elem ) {
@@ -5257,7 +5349,7 @@ if ( document.documentElement.contains ) {
5257
5349
 
5258
5350
  Sizzle.isXML = function( elem ) {
5259
5351
  // documentElement is verified for cases where it doesn't yet exist
5260
- // (such as loading iframes in IE - #4833)
5352
+ // (such as loading iframes in IE - #4833)
5261
5353
  var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
5262
5354
 
5263
5355
  return documentElement ? documentElement.nodeName !== "HTML" : false;
@@ -5307,7 +5399,7 @@ var runtil = /Until$/,
5307
5399
  rmultiselector = /,/,
5308
5400
  isSimple = /^.[^:#\[\.,]*$/,
5309
5401
  slice = Array.prototype.slice,
5310
- POS = jQuery.expr.match.POS,
5402
+ POS = jQuery.expr.match.globalPOS,
5311
5403
  // methods guaranteed to produce a unique set when starting from a unique set
5312
5404
  guaranteedUnique = {
5313
5405
  children: true,
@@ -5374,11 +5466,11 @@ jQuery.fn.extend({
5374
5466
  },
5375
5467
 
5376
5468
  is: function( selector ) {
5377
- return !!selector && (
5469
+ return !!selector && (
5378
5470
  typeof selector === "string" ?
5379
5471
  // If this is a positional selector, check membership in the returned set
5380
5472
  // so $("p:first").is("p:last") won't return true for a doc with two "p".
5381
- POS.test( selector ) ?
5473
+ POS.test( selector ) ?
5382
5474
  jQuery( selector, this.context ).index( this[0] ) >= 0 :
5383
5475
  jQuery.filter( selector, this ).length > 0 :
5384
5476
  this.filter( selector ).length > 0 );
@@ -5386,7 +5478,7 @@ jQuery.fn.extend({
5386
5478
 
5387
5479
  closest: function( selectors, context ) {
5388
5480
  var ret = [], i, l, cur = this[0];
5389
-
5481
+
5390
5482
  // Array (deprecated as of jQuery 1.7)
5391
5483
  if ( jQuery.isArray( selectors ) ) {
5392
5484
  var level = 1;
@@ -5505,7 +5597,7 @@ jQuery.each({
5505
5597
  return jQuery.dir( elem, "previousSibling", until );
5506
5598
  },
5507
5599
  siblings: function( elem ) {
5508
- return jQuery.sibling( elem.parentNode.firstChild, elem );
5600
+ return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
5509
5601
  },
5510
5602
  children: function( elem ) {
5511
5603
  return jQuery.sibling( elem.firstChild );
@@ -5639,7 +5731,7 @@ function createSafeFragment( document ) {
5639
5731
  return safeFrag;
5640
5732
  }
5641
5733
 
5642
- var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" +
5734
+ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
5643
5735
  "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
5644
5736
  rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
5645
5737
  rleadingWhitespace = /^\s+/,
@@ -5649,7 +5741,7 @@ var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|fig
5649
5741
  rhtml = /<|&#?\w+;/,
5650
5742
  rnoInnerhtml = /<(?:script|style)/i,
5651
5743
  rnocache = /<(?:script|object|embed|option|style)/i,
5652
- rnoshimcache = new RegExp("<(?:" + nodeNames + ")", "i"),
5744
+ rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
5653
5745
  // checked="checked" or checked
5654
5746
  rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5655
5747
  rscriptType = /\/(java|ecma)script/i,
@@ -5676,20 +5768,12 @@ if ( !jQuery.support.htmlSerialize ) {
5676
5768
  }
5677
5769
 
5678
5770
  jQuery.fn.extend({
5679
- text: function( text ) {
5680
- if ( jQuery.isFunction(text) ) {
5681
- return this.each(function(i) {
5682
- var self = jQuery( this );
5683
-
5684
- self.text( text.call(this, i, self.text()) );
5685
- });
5686
- }
5687
-
5688
- if ( typeof text !== "object" && text !== undefined ) {
5689
- return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
5690
- }
5691
-
5692
- return jQuery.text( this );
5771
+ text: function( value ) {
5772
+ return jQuery.access( this, function( value ) {
5773
+ return value === undefined ?
5774
+ jQuery.text( this ) :
5775
+ this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
5776
+ }, null, value, arguments.length );
5693
5777
  },
5694
5778
 
5695
5779
  wrapAll: function( html ) {
@@ -5841,44 +5925,44 @@ jQuery.fn.extend({
5841
5925
  },
5842
5926
 
5843
5927
  html: function( value ) {
5844
- if ( value === undefined ) {
5845
- return this[0] && this[0].nodeType === 1 ?
5846
- this[0].innerHTML.replace(rinlinejQuery, "") :
5847
- null;
5928
+ return jQuery.access( this, function( value ) {
5929
+ var elem = this[0] || {},
5930
+ i = 0,
5931
+ l = this.length;
5848
5932
 
5849
- // See if we can take a shortcut and just use innerHTML
5850
- } else if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5851
- (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
5852
- !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
5933
+ if ( value === undefined ) {
5934
+ return elem.nodeType === 1 ?
5935
+ elem.innerHTML.replace( rinlinejQuery, "" ) :
5936
+ null;
5937
+ }
5853
5938
 
5854
- value = value.replace(rxhtmlTag, "<$1></$2>");
5855
5939
 
5856
- try {
5857
- for ( var i = 0, l = this.length; i < l; i++ ) {
5858
- // Remove element nodes and prevent memory leaks
5859
- if ( this[i].nodeType === 1 ) {
5860
- jQuery.cleanData( this[i].getElementsByTagName("*") );
5861
- this[i].innerHTML = value;
5862
- }
5863
- }
5940
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5941
+ ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
5942
+ !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
5864
5943
 
5865
- // If using innerHTML throws an exception, use the fallback method
5866
- } catch(e) {
5867
- this.empty().append( value );
5868
- }
5944
+ value = value.replace( rxhtmlTag, "<$1></$2>" );
5869
5945
 
5870
- } else if ( jQuery.isFunction( value ) ) {
5871
- this.each(function(i){
5872
- var self = jQuery( this );
5946
+ try {
5947
+ for (; i < l; i++ ) {
5948
+ // Remove element nodes and prevent memory leaks
5949
+ elem = this[i] || {};
5950
+ if ( elem.nodeType === 1 ) {
5951
+ jQuery.cleanData( elem.getElementsByTagName( "*" ) );
5952
+ elem.innerHTML = value;
5953
+ }
5954
+ }
5873
5955
 
5874
- self.html( value.call(this, i, self.html()) );
5875
- });
5956
+ elem = 0;
5876
5957
 
5877
- } else {
5878
- this.empty().append( value );
5879
- }
5958
+ // If using innerHTML throws an exception, use the fallback method
5959
+ } catch(e) {}
5960
+ }
5880
5961
 
5881
- return this;
5962
+ if ( elem ) {
5963
+ this.empty().append( value );
5964
+ }
5965
+ }, null, value, arguments.length );
5882
5966
  },
5883
5967
 
5884
5968
  replaceWith: function( value ) {
@@ -5981,7 +6065,23 @@ jQuery.fn.extend({
5981
6065
  }
5982
6066
 
5983
6067
  if ( scripts.length ) {
5984
- jQuery.each( scripts, evalScript );
6068
+ jQuery.each( scripts, function( i, elem ) {
6069
+ if ( elem.src ) {
6070
+ jQuery.ajax({
6071
+ type: "GET",
6072
+ global: false,
6073
+ url: elem.src,
6074
+ async: false,
6075
+ dataType: "script"
6076
+ });
6077
+ } else {
6078
+ jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
6079
+ }
6080
+
6081
+ if ( elem.parentNode ) {
6082
+ elem.parentNode.removeChild( elem );
6083
+ }
6084
+ });
5985
6085
  }
5986
6086
  }
5987
6087
 
@@ -6013,7 +6113,7 @@ function cloneCopyEvent( src, dest ) {
6013
6113
 
6014
6114
  for ( type in events ) {
6015
6115
  for ( i = 0, l = events[ type ].length; i < l; i++ ) {
6016
- jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
6116
+ jQuery.event.add( dest, type, events[ type ][ i ] );
6017
6117
  }
6018
6118
  }
6019
6119
  }
@@ -6075,11 +6175,20 @@ function cloneFixAttributes( src, dest ) {
6075
6175
  // cloning other types of input fields
6076
6176
  } else if ( nodeName === "input" || nodeName === "textarea" ) {
6077
6177
  dest.defaultValue = src.defaultValue;
6178
+
6179
+ // IE blanks contents when cloning scripts
6180
+ } else if ( nodeName === "script" && dest.text !== src.text ) {
6181
+ dest.text = src.text;
6078
6182
  }
6079
6183
 
6080
6184
  // Event data gets referenced instead of copied if the expando
6081
6185
  // gets copied too
6082
6186
  dest.removeAttribute( jQuery.expando );
6187
+
6188
+ // Clear flags for bubbling special change/submit events, they must
6189
+ // be reattached when the newly cloned events are first activated
6190
+ dest.removeAttribute( "_submit_attached" );
6191
+ dest.removeAttribute( "_change_attached" );
6083
6192
  }
6084
6193
 
6085
6194
  jQuery.buildFragment = function( args, nodes, scripts ) {
@@ -6204,7 +6313,7 @@ jQuery.extend({
6204
6313
  destElements,
6205
6314
  i,
6206
6315
  // IE<=8 does not properly clone detached, unknown element nodes
6207
- clone = jQuery.support.html5Clone || !rnoshimcache.test( "<" + elem.nodeName ) ?
6316
+ clone = jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ?
6208
6317
  elem.cloneNode( true ) :
6209
6318
  shimCloneNode( elem );
6210
6319
 
@@ -6254,7 +6363,8 @@ jQuery.extend({
6254
6363
  },
6255
6364
 
6256
6365
  clean: function( elems, context, fragment, scripts ) {
6257
- var checkScriptType;
6366
+ var checkScriptType, script, j,
6367
+ ret = [];
6258
6368
 
6259
6369
  context = context || document;
6260
6370
 
@@ -6263,8 +6373,6 @@ jQuery.extend({
6263
6373
  context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
6264
6374
  }
6265
6375
 
6266
- var ret = [], j;
6267
-
6268
6376
  for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
6269
6377
  if ( typeof elem === "number" ) {
6270
6378
  elem += "";
@@ -6286,7 +6394,9 @@ jQuery.extend({
6286
6394
  var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
6287
6395
  wrap = wrapMap[ tag ] || wrapMap._default,
6288
6396
  depth = wrap[0],
6289
- div = context.createElement("div");
6397
+ div = context.createElement("div"),
6398
+ safeChildNodes = safeFragment.childNodes,
6399
+ remove;
6290
6400
 
6291
6401
  // Append wrapper element to unknown element safe doc fragment
6292
6402
  if ( context === document ) {
@@ -6331,6 +6441,21 @@ jQuery.extend({
6331
6441
  }
6332
6442
 
6333
6443
  elem = div.childNodes;
6444
+
6445
+ // Clear elements from DocumentFragment (safeFragment or otherwise)
6446
+ // to avoid hoarding elements. Fixes #11356
6447
+ if ( div ) {
6448
+ div.parentNode.removeChild( div );
6449
+
6450
+ // Guard against -1 index exceptions in FF3.6
6451
+ if ( safeChildNodes.length > 0 ) {
6452
+ remove = safeChildNodes[ safeChildNodes.length - 1 ];
6453
+
6454
+ if ( remove && remove.parentNode ) {
6455
+ remove.parentNode.removeChild( remove );
6456
+ }
6457
+ }
6458
+ }
6334
6459
  }
6335
6460
  }
6336
6461
 
@@ -6359,16 +6484,17 @@ jQuery.extend({
6359
6484
  return !elem.type || rscriptType.test( elem.type );
6360
6485
  };
6361
6486
  for ( i = 0; ret[i]; i++ ) {
6362
- if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
6363
- scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
6487
+ script = ret[i];
6488
+ if ( scripts && jQuery.nodeName( script, "script" ) && (!script.type || rscriptType.test( script.type )) ) {
6489
+ scripts.push( script.parentNode ? script.parentNode.removeChild( script ) : script );
6364
6490
 
6365
6491
  } else {
6366
- if ( ret[i].nodeType === 1 ) {
6367
- var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
6492
+ if ( script.nodeType === 1 ) {
6493
+ var jsTags = jQuery.grep( script.getElementsByTagName( "script" ), checkScriptType );
6368
6494
 
6369
6495
  ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
6370
6496
  }
6371
- fragment.appendChild( ret[i] );
6497
+ fragment.appendChild( script );
6372
6498
  }
6373
6499
  }
6374
6500
  }
@@ -6422,22 +6548,6 @@ jQuery.extend({
6422
6548
  }
6423
6549
  });
6424
6550
 
6425
- function evalScript( i, elem ) {
6426
- if ( elem.src ) {
6427
- jQuery.ajax({
6428
- url: elem.src,
6429
- async: false,
6430
- dataType: "script"
6431
- });
6432
- } else {
6433
- jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
6434
- }
6435
-
6436
- if ( elem.parentNode ) {
6437
- elem.parentNode.removeChild( elem );
6438
- }
6439
- }
6440
-
6441
6551
 
6442
6552
 
6443
6553
 
@@ -6445,29 +6555,27 @@ var ralpha = /alpha\([^)]*\)/i,
6445
6555
  ropacity = /opacity=([^)]*)/,
6446
6556
  // fixed for IE9, see #8346
6447
6557
  rupper = /([A-Z]|^ms)/g,
6448
- rnumpx = /^-?\d+(?:px)?$/i,
6449
- rnum = /^-?\d/,
6558
+ rnum = /^[\-+]?(?:\d*\.)?\d+$/i,
6559
+ rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
6450
6560
  rrelNum = /^([\-+])=([\-+.\de]+)/,
6561
+ rmargin = /^margin/,
6451
6562
 
6452
6563
  cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6453
- cssWidth = [ "Left", "Right" ],
6454
- cssHeight = [ "Top", "Bottom" ],
6564
+
6565
+ // order is important!
6566
+ cssExpand = [ "Top", "Right", "Bottom", "Left" ],
6567
+
6455
6568
  curCSS,
6456
6569
 
6457
6570
  getComputedStyle,
6458
6571
  currentStyle;
6459
6572
 
6460
6573
  jQuery.fn.css = function( name, value ) {
6461
- // Setting 'undefined' is a no-op
6462
- if ( arguments.length === 2 && value === undefined ) {
6463
- return this;
6464
- }
6465
-
6466
- return jQuery.access( this, name, value, true, function( elem, name, value ) {
6574
+ return jQuery.access( this, function( elem, name, value ) {
6467
6575
  return value !== undefined ?
6468
6576
  jQuery.style( elem, name, value ) :
6469
6577
  jQuery.css( elem, name );
6470
- });
6578
+ }, name, value, arguments.length > 1 );
6471
6579
  };
6472
6580
 
6473
6581
  jQuery.extend({
@@ -6478,7 +6586,7 @@ jQuery.extend({
6478
6586
  get: function( elem, computed ) {
6479
6587
  if ( computed ) {
6480
6588
  // We should always get a number back from opacity
6481
- var ret = curCSS( elem, "opacity", "opacity" );
6589
+ var ret = curCSS( elem, "opacity" );
6482
6590
  return ret === "" ? "1" : ret;
6483
6591
 
6484
6592
  } else {
@@ -6586,137 +6694,55 @@ jQuery.extend({
6586
6694
 
6587
6695
  // A method for quickly swapping in/out CSS properties to get correct calculations
6588
6696
  swap: function( elem, options, callback ) {
6589
- var old = {};
6697
+ var old = {},
6698
+ ret, name;
6590
6699
 
6591
6700
  // Remember the old values, and insert the new ones
6592
- for ( var name in options ) {
6701
+ for ( name in options ) {
6593
6702
  old[ name ] = elem.style[ name ];
6594
6703
  elem.style[ name ] = options[ name ];
6595
6704
  }
6596
6705
 
6597
- callback.call( elem );
6706
+ ret = callback.call( elem );
6598
6707
 
6599
6708
  // Revert the old values
6600
6709
  for ( name in options ) {
6601
6710
  elem.style[ name ] = old[ name ];
6602
6711
  }
6712
+
6713
+ return ret;
6603
6714
  }
6604
6715
  });
6605
6716
 
6606
- // DEPRECATED, Use jQuery.css() instead
6717
+ // DEPRECATED in 1.3, Use jQuery.css() instead
6607
6718
  jQuery.curCSS = jQuery.css;
6608
6719
 
6609
- jQuery.each(["height", "width"], function( i, name ) {
6610
- jQuery.cssHooks[ name ] = {
6611
- get: function( elem, computed, extra ) {
6612
- var val;
6613
-
6614
- if ( computed ) {
6615
- if ( elem.offsetWidth !== 0 ) {
6616
- return getWH( elem, name, extra );
6617
- } else {
6618
- jQuery.swap( elem, cssShow, function() {
6619
- val = getWH( elem, name, extra );
6620
- });
6621
- }
6622
-
6623
- return val;
6624
- }
6625
- },
6626
-
6627
- set: function( elem, value ) {
6628
- if ( rnumpx.test( value ) ) {
6629
- // ignore negative width and height values #1599
6630
- value = parseFloat( value );
6631
-
6632
- if ( value >= 0 ) {
6633
- return value + "px";
6634
- }
6635
-
6636
- } else {
6637
- return value;
6638
- }
6639
- }
6640
- };
6641
- });
6642
-
6643
- if ( !jQuery.support.opacity ) {
6644
- jQuery.cssHooks.opacity = {
6645
- get: function( elem, computed ) {
6646
- // IE uses filters for opacity
6647
- return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
6648
- ( parseFloat( RegExp.$1 ) / 100 ) + "" :
6649
- computed ? "1" : "";
6650
- },
6651
-
6652
- set: function( elem, value ) {
6653
- var style = elem.style,
6654
- currentStyle = elem.currentStyle,
6655
- opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
6656
- filter = currentStyle && currentStyle.filter || style.filter || "";
6657
-
6658
- // IE has trouble with opacity if it does not have layout
6659
- // Force it by setting the zoom level
6660
- style.zoom = 1;
6661
-
6662
- // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
6663
- if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
6664
-
6665
- // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
6666
- // if "filter:" is present at all, clearType is disabled, we want to avoid this
6667
- // style.removeAttribute is IE Only, but so apparently is this code path...
6668
- style.removeAttribute( "filter" );
6669
-
6670
- // if there there is no filter style applied in a css rule, we are done
6671
- if ( currentStyle && !currentStyle.filter ) {
6672
- return;
6673
- }
6674
- }
6675
-
6676
- // otherwise, set new filter values
6677
- style.filter = ralpha.test( filter ) ?
6678
- filter.replace( ralpha, opacity ) :
6679
- filter + " " + opacity;
6680
- }
6681
- };
6682
- }
6683
-
6684
- jQuery(function() {
6685
- // This hook cannot be added until DOM ready because the support test
6686
- // for it is not run until after DOM ready
6687
- if ( !jQuery.support.reliableMarginRight ) {
6688
- jQuery.cssHooks.marginRight = {
6689
- get: function( elem, computed ) {
6690
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
6691
- // Work around by temporarily setting element display to inline-block
6692
- var ret;
6693
- jQuery.swap( elem, { "display": "inline-block" }, function() {
6694
- if ( computed ) {
6695
- ret = curCSS( elem, "margin-right", "marginRight" );
6696
- } else {
6697
- ret = elem.style.marginRight;
6698
- }
6699
- });
6700
- return ret;
6701
- }
6702
- };
6703
- }
6704
- });
6705
-
6706
6720
  if ( document.defaultView && document.defaultView.getComputedStyle ) {
6707
6721
  getComputedStyle = function( elem, name ) {
6708
- var ret, defaultView, computedStyle;
6722
+ var ret, defaultView, computedStyle, width,
6723
+ style = elem.style;
6709
6724
 
6710
6725
  name = name.replace( rupper, "-$1" ).toLowerCase();
6711
6726
 
6712
6727
  if ( (defaultView = elem.ownerDocument.defaultView) &&
6713
6728
  (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
6729
+
6714
6730
  ret = computedStyle.getPropertyValue( name );
6715
6731
  if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
6716
6732
  ret = jQuery.style( elem, name );
6717
6733
  }
6718
6734
  }
6719
6735
 
6736
+ // A tribute to the "awesome hack by Dean Edwards"
6737
+ // WebKit uses "computed value (percentage if specified)" instead of "used value" for margins
6738
+ // which is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
6739
+ if ( !jQuery.support.pixelMargin && computedStyle && rmargin.test( name ) && rnumnonpx.test( ret ) ) {
6740
+ width = style.width;
6741
+ style.width = ret;
6742
+ ret = computedStyle.width;
6743
+ style.width = width;
6744
+ }
6745
+
6720
6746
  return ret;
6721
6747
  };
6722
6748
  }
@@ -6729,7 +6755,7 @@ if ( document.documentElement.currentStyle ) {
6729
6755
 
6730
6756
  // Avoid setting ret to empty string here
6731
6757
  // so we don't default to auto
6732
- if ( ret === null && style && (uncomputed = style[ name ]) ) {
6758
+ if ( ret == null && style && (uncomputed = style[ name ]) ) {
6733
6759
  ret = uncomputed;
6734
6760
  }
6735
6761
 
@@ -6738,7 +6764,7 @@ if ( document.documentElement.currentStyle ) {
6738
6764
 
6739
6765
  // If we're not dealing with a regular pixel number
6740
6766
  // but a number that has a weird ending, we need to convert it to pixels
6741
- if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
6767
+ if ( rnumnonpx.test( ret ) ) {
6742
6768
 
6743
6769
  // Remember the original values
6744
6770
  left = style.left;
@@ -6748,7 +6774,7 @@ if ( document.documentElement.currentStyle ) {
6748
6774
  if ( rsLeft ) {
6749
6775
  elem.runtimeStyle.left = elem.currentStyle.left;
6750
6776
  }
6751
- style.left = name === "fontSize" ? "1em" : ( ret || 0 );
6777
+ style.left = name === "fontSize" ? "1em" : ret;
6752
6778
  ret = style.pixelLeft + "px";
6753
6779
 
6754
6780
  // Revert the changed values
@@ -6764,24 +6790,23 @@ if ( document.documentElement.currentStyle ) {
6764
6790
 
6765
6791
  curCSS = getComputedStyle || currentStyle;
6766
6792
 
6767
- function getWH( elem, name, extra ) {
6793
+ function getWidthOrHeight( elem, name, extra ) {
6768
6794
 
6769
6795
  // Start with offset property
6770
6796
  var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
6771
- which = name === "width" ? cssWidth : cssHeight,
6772
- i = 0,
6773
- len = which.length;
6797
+ i = name === "width" ? 1 : 0,
6798
+ len = 4;
6774
6799
 
6775
6800
  if ( val > 0 ) {
6776
6801
  if ( extra !== "border" ) {
6777
- for ( ; i < len; i++ ) {
6802
+ for ( ; i < len; i += 2 ) {
6778
6803
  if ( !extra ) {
6779
- val -= parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0;
6804
+ val -= parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
6780
6805
  }
6781
6806
  if ( extra === "margin" ) {
6782
- val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0;
6807
+ val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ] ) ) || 0;
6783
6808
  } else {
6784
- val -= parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0;
6809
+ val -= parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
6785
6810
  }
6786
6811
  }
6787
6812
  }
@@ -6790,22 +6815,28 @@ function getWH( elem, name, extra ) {
6790
6815
  }
6791
6816
 
6792
6817
  // Fall back to computed then uncomputed css if necessary
6793
- val = curCSS( elem, name, name );
6818
+ val = curCSS( elem, name );
6794
6819
  if ( val < 0 || val == null ) {
6795
- val = elem.style[ name ] || 0;
6820
+ val = elem.style[ name ];
6796
6821
  }
6822
+
6823
+ // Computed unit is not pixels. Stop here and return.
6824
+ if ( rnumnonpx.test(val) ) {
6825
+ return val;
6826
+ }
6827
+
6797
6828
  // Normalize "", auto, and prepare for extra
6798
6829
  val = parseFloat( val ) || 0;
6799
6830
 
6800
6831
  // Add padding, border, margin
6801
6832
  if ( extra ) {
6802
- for ( ; i < len; i++ ) {
6803
- val += parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0;
6833
+ for ( ; i < len; i += 2 ) {
6834
+ val += parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
6804
6835
  if ( extra !== "padding" ) {
6805
- val += parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0;
6836
+ val += parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
6806
6837
  }
6807
6838
  if ( extra === "margin" ) {
6808
- val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0;
6839
+ val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ]) ) || 0;
6809
6840
  }
6810
6841
  }
6811
6842
  }
@@ -6813,6 +6844,89 @@ function getWH( elem, name, extra ) {
6813
6844
  return val + "px";
6814
6845
  }
6815
6846
 
6847
+ jQuery.each([ "height", "width" ], function( i, name ) {
6848
+ jQuery.cssHooks[ name ] = {
6849
+ get: function( elem, computed, extra ) {
6850
+ if ( computed ) {
6851
+ if ( elem.offsetWidth !== 0 ) {
6852
+ return getWidthOrHeight( elem, name, extra );
6853
+ } else {
6854
+ return jQuery.swap( elem, cssShow, function() {
6855
+ return getWidthOrHeight( elem, name, extra );
6856
+ });
6857
+ }
6858
+ }
6859
+ },
6860
+
6861
+ set: function( elem, value ) {
6862
+ return rnum.test( value ) ?
6863
+ value + "px" :
6864
+ value;
6865
+ }
6866
+ };
6867
+ });
6868
+
6869
+ if ( !jQuery.support.opacity ) {
6870
+ jQuery.cssHooks.opacity = {
6871
+ get: function( elem, computed ) {
6872
+ // IE uses filters for opacity
6873
+ return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
6874
+ ( parseFloat( RegExp.$1 ) / 100 ) + "" :
6875
+ computed ? "1" : "";
6876
+ },
6877
+
6878
+ set: function( elem, value ) {
6879
+ var style = elem.style,
6880
+ currentStyle = elem.currentStyle,
6881
+ opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
6882
+ filter = currentStyle && currentStyle.filter || style.filter || "";
6883
+
6884
+ // IE has trouble with opacity if it does not have layout
6885
+ // Force it by setting the zoom level
6886
+ style.zoom = 1;
6887
+
6888
+ // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
6889
+ if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
6890
+
6891
+ // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
6892
+ // if "filter:" is present at all, clearType is disabled, we want to avoid this
6893
+ // style.removeAttribute is IE Only, but so apparently is this code path...
6894
+ style.removeAttribute( "filter" );
6895
+
6896
+ // if there there is no filter style applied in a css rule, we are done
6897
+ if ( currentStyle && !currentStyle.filter ) {
6898
+ return;
6899
+ }
6900
+ }
6901
+
6902
+ // otherwise, set new filter values
6903
+ style.filter = ralpha.test( filter ) ?
6904
+ filter.replace( ralpha, opacity ) :
6905
+ filter + " " + opacity;
6906
+ }
6907
+ };
6908
+ }
6909
+
6910
+ jQuery(function() {
6911
+ // This hook cannot be added until DOM ready because the support test
6912
+ // for it is not run until after DOM ready
6913
+ if ( !jQuery.support.reliableMarginRight ) {
6914
+ jQuery.cssHooks.marginRight = {
6915
+ get: function( elem, computed ) {
6916
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
6917
+ // Work around by temporarily setting element display to inline-block
6918
+ return jQuery.swap( elem, { "display": "inline-block" }, function() {
6919
+ if ( computed ) {
6920
+ return curCSS( elem, "margin-right" );
6921
+ } else {
6922
+ return elem.style.marginRight;
6923
+ }
6924
+ });
6925
+ }
6926
+ };
6927
+ }
6928
+ });
6929
+
6816
6930
  if ( jQuery.expr && jQuery.expr.filters ) {
6817
6931
  jQuery.expr.filters.hidden = function( elem ) {
6818
6932
  var width = elem.offsetWidth,
@@ -6826,6 +6940,31 @@ if ( jQuery.expr && jQuery.expr.filters ) {
6826
6940
  };
6827
6941
  }
6828
6942
 
6943
+ // These hooks are used by animate to expand properties
6944
+ jQuery.each({
6945
+ margin: "",
6946
+ padding: "",
6947
+ border: "Width"
6948
+ }, function( prefix, suffix ) {
6949
+
6950
+ jQuery.cssHooks[ prefix + suffix ] = {
6951
+ expand: function( value ) {
6952
+ var i,
6953
+
6954
+ // assumes a single number if not a string
6955
+ parts = typeof value === "string" ? value.split(" ") : [ value ],
6956
+ expanded = {};
6957
+
6958
+ for ( i = 0; i < 4; i++ ) {
6959
+ expanded[ prefix + cssExpand[ i ] + suffix ] =
6960
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6961
+ }
6962
+
6963
+ return expanded;
6964
+ }
6965
+ };
6966
+ });
6967
+
6829
6968
 
6830
6969
 
6831
6970
 
@@ -7144,7 +7283,7 @@ jQuery.extend({
7144
7283
  isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
7145
7284
  global: true,
7146
7285
  type: "GET",
7147
- contentType: "application/x-www-form-urlencoded",
7286
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",
7148
7287
  processData: true,
7149
7288
  async: true,
7150
7289
  /*
@@ -7470,7 +7609,7 @@ jQuery.extend({
7470
7609
  // Apply prefilters
7471
7610
  inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
7472
7611
 
7473
- // If request was aborted inside a prefiler, stop there
7612
+ // If request was aborted inside a prefilter, stop there
7474
7613
  if ( state === 2 ) {
7475
7614
  return false;
7476
7615
  }
@@ -7643,11 +7782,11 @@ function buildParams( prefix, obj, traditional, add ) {
7643
7782
  // a server error. Possible fixes are to modify rack's
7644
7783
  // deserialization algorithm or to provide an option or flag
7645
7784
  // to force array serialization to be shallow.
7646
- buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
7785
+ buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
7647
7786
  }
7648
7787
  });
7649
7788
 
7650
- } else if ( !traditional && obj != null && typeof obj === "object" ) {
7789
+ } else if ( !traditional && jQuery.type( obj ) === "object" ) {
7651
7790
  // Serialize object item.
7652
7791
  for ( var name in obj ) {
7653
7792
  buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
@@ -7843,8 +7982,7 @@ jQuery.ajaxSetup({
7843
7982
  // Detect, normalize options and install callbacks for jsonp requests
7844
7983
  jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
7845
7984
 
7846
- var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
7847
- ( typeof s.data === "string" );
7985
+ var inspectData = ( typeof s.data === "string" ) && /^application\/x\-www\-form\-urlencoded/.test( s.contentType );
7848
7986
 
7849
7987
  if ( s.dataTypes[ 0 ] === "jsonp" ||
7850
7988
  s.jsonp !== false && ( jsre.test( s.url ) ||
@@ -8145,7 +8283,13 @@ if ( jQuery.support.ajax ) {
8145
8283
  if ( xml && xml.documentElement /* #4958 */ ) {
8146
8284
  responses.xml = xml;
8147
8285
  }
8148
- responses.text = xhr.responseText;
8286
+
8287
+ // When requesting binary data, IE6-9 will throw an exception
8288
+ // on any attempt to access responseText (#11426)
8289
+ try {
8290
+ responses.text = xhr.responseText;
8291
+ } catch( _ ) {
8292
+ }
8149
8293
 
8150
8294
  // Firefox throws an exception when accessing
8151
8295
  // statusText for faulty cross-domain requests
@@ -8253,7 +8397,8 @@ jQuery.fn.extend({
8253
8397
  // Set elements which have been overridden with display: none
8254
8398
  // in a stylesheet to whatever the default browser style is
8255
8399
  // for such an element
8256
- if ( display === "" && jQuery.css(elem, "display") === "none" ) {
8400
+ if ( (display === "" && jQuery.css(elem, "display") === "none") ||
8401
+ !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
8257
8402
  jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
8258
8403
  }
8259
8404
  }
@@ -8357,24 +8502,37 @@ jQuery.fn.extend({
8357
8502
  var opt = jQuery.extend( {}, optall ),
8358
8503
  isElement = this.nodeType === 1,
8359
8504
  hidden = isElement && jQuery(this).is(":hidden"),
8360
- name, val, p, e,
8505
+ name, val, p, e, hooks, replace,
8361
8506
  parts, start, end, unit,
8362
8507
  method;
8363
8508
 
8364
8509
  // will store per property easing and be used to determine when an animation is complete
8365
8510
  opt.animatedProperties = {};
8366
8511
 
8512
+ // first pass over propertys to expand / normalize
8367
8513
  for ( p in prop ) {
8368
-
8369
- // property name normalization
8370
8514
  name = jQuery.camelCase( p );
8371
8515
  if ( p !== name ) {
8372
8516
  prop[ name ] = prop[ p ];
8373
8517
  delete prop[ p ];
8374
8518
  }
8375
8519
 
8376
- val = prop[ name ];
8520
+ if ( ( hooks = jQuery.cssHooks[ name ] ) && "expand" in hooks ) {
8521
+ replace = hooks.expand( prop[ name ] );
8522
+ delete prop[ name ];
8377
8523
 
8524
+ // not quite $.extend, this wont overwrite keys already present.
8525
+ // also - reusing 'p' from above because we have the correct "name"
8526
+ for ( p in replace ) {
8527
+ if ( ! ( p in prop ) ) {
8528
+ prop[ p ] = replace[ p ];
8529
+ }
8530
+ }
8531
+ }
8532
+ }
8533
+
8534
+ for ( name in prop ) {
8535
+ val = prop[ name ];
8378
8536
  // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
8379
8537
  if ( jQuery.isArray( val ) ) {
8380
8538
  opt.animatedProperties[ name ] = val[ 1 ];
@@ -8601,11 +8759,11 @@ jQuery.extend({
8601
8759
  },
8602
8760
 
8603
8761
  easing: {
8604
- linear: function( p, n, firstNum, diff ) {
8605
- return firstNum + diff * p;
8762
+ linear: function( p ) {
8763
+ return p;
8606
8764
  },
8607
- swing: function( p, n, firstNum, diff ) {
8608
- return ( ( -Math.cos( p*Math.PI ) / 2 ) + 0.5 ) * diff + firstNum;
8765
+ swing: function( p ) {
8766
+ return ( -Math.cos( p*Math.PI ) / 2 ) + 0.5;
8609
8767
  }
8610
8768
  },
8611
8769
 
@@ -8663,8 +8821,12 @@ jQuery.fx.prototype = {
8663
8821
  t.queue = this.options.queue;
8664
8822
  t.elem = this.elem;
8665
8823
  t.saveState = function() {
8666
- if ( self.options.hide && jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
8667
- jQuery._data( self.elem, "fxshow" + self.prop, self.start );
8824
+ if ( jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
8825
+ if ( self.options.hide ) {
8826
+ jQuery._data( self.elem, "fxshow" + self.prop, self.start );
8827
+ } else if ( self.options.show ) {
8828
+ jQuery._data( self.elem, "fxshow" + self.prop, self.end );
8829
+ }
8668
8830
  }
8669
8831
  };
8670
8832
 
@@ -8831,12 +8993,14 @@ jQuery.extend( jQuery.fx, {
8831
8993
  }
8832
8994
  });
8833
8995
 
8834
- // Adds width/height step functions
8835
- // Do not set anything below 0
8836
- jQuery.each([ "width", "height" ], function( i, prop ) {
8837
- jQuery.fx.step[ prop ] = function( fx ) {
8838
- jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
8839
- };
8996
+ // Ensure props that can't be negative don't go there on undershoot easing
8997
+ jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) {
8998
+ // exclude marginTop, marginLeft, marginBottom and marginRight from this list
8999
+ if ( prop.indexOf( "margin" ) ) {
9000
+ jQuery.fx.step[ prop ] = function( fx ) {
9001
+ jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
9002
+ };
9003
+ }
8840
9004
  });
8841
9005
 
8842
9006
  if ( jQuery.expr && jQuery.expr.filters ) {
@@ -8873,7 +9037,7 @@ function defaultDisplay( nodeName ) {
8873
9037
  // document to it; WebKit & Firefox won't allow reusing the iframe document.
8874
9038
  if ( !iframeDoc || !iframe.createElement ) {
8875
9039
  iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
8876
- iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
9040
+ iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" );
8877
9041
  iframeDoc.close();
8878
9042
  }
8879
9043
 
@@ -8895,41 +9059,23 @@ function defaultDisplay( nodeName ) {
8895
9059
 
8896
9060
 
8897
9061
 
8898
- var rtable = /^t(?:able|d|h)$/i,
9062
+ var getOffset,
9063
+ rtable = /^t(?:able|d|h)$/i,
8899
9064
  rroot = /^(?:body|html)$/i;
8900
9065
 
8901
9066
  if ( "getBoundingClientRect" in document.documentElement ) {
8902
- jQuery.fn.offset = function( options ) {
8903
- var elem = this[0], box;
8904
-
8905
- if ( options ) {
8906
- return this.each(function( i ) {
8907
- jQuery.offset.setOffset( this, options, i );
8908
- });
8909
- }
8910
-
8911
- if ( !elem || !elem.ownerDocument ) {
8912
- return null;
8913
- }
8914
-
8915
- if ( elem === elem.ownerDocument.body ) {
8916
- return jQuery.offset.bodyOffset( elem );
8917
- }
8918
-
9067
+ getOffset = function( elem, doc, docElem, box ) {
8919
9068
  try {
8920
9069
  box = elem.getBoundingClientRect();
8921
9070
  } catch(e) {}
8922
9071
 
8923
- var doc = elem.ownerDocument,
8924
- docElem = doc.documentElement;
8925
-
8926
9072
  // Make sure we're not dealing with a disconnected DOM node
8927
9073
  if ( !box || !jQuery.contains( docElem, elem ) ) {
8928
9074
  return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
8929
9075
  }
8930
9076
 
8931
9077
  var body = doc.body,
8932
- win = getWindow(doc),
9078
+ win = getWindow( doc ),
8933
9079
  clientTop = docElem.clientTop || body.clientTop || 0,
8934
9080
  clientLeft = docElem.clientLeft || body.clientLeft || 0,
8935
9081
  scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
@@ -8941,28 +9087,10 @@ if ( "getBoundingClientRect" in document.documentElement ) {
8941
9087
  };
8942
9088
 
8943
9089
  } else {
8944
- jQuery.fn.offset = function( options ) {
8945
- var elem = this[0];
8946
-
8947
- if ( options ) {
8948
- return this.each(function( i ) {
8949
- jQuery.offset.setOffset( this, options, i );
8950
- });
8951
- }
8952
-
8953
- if ( !elem || !elem.ownerDocument ) {
8954
- return null;
8955
- }
8956
-
8957
- if ( elem === elem.ownerDocument.body ) {
8958
- return jQuery.offset.bodyOffset( elem );
8959
- }
8960
-
9090
+ getOffset = function( elem, doc, docElem ) {
8961
9091
  var computedStyle,
8962
9092
  offsetParent = elem.offsetParent,
8963
9093
  prevOffsetParent = elem,
8964
- doc = elem.ownerDocument,
8965
- docElem = doc.documentElement,
8966
9094
  body = doc.body,
8967
9095
  defaultView = doc.defaultView,
8968
9096
  prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
@@ -9013,6 +9141,29 @@ if ( "getBoundingClientRect" in document.documentElement ) {
9013
9141
  };
9014
9142
  }
9015
9143
 
9144
+ jQuery.fn.offset = function( options ) {
9145
+ if ( arguments.length ) {
9146
+ return options === undefined ?
9147
+ this :
9148
+ this.each(function( i ) {
9149
+ jQuery.offset.setOffset( this, options, i );
9150
+ });
9151
+ }
9152
+
9153
+ var elem = this[0],
9154
+ doc = elem && elem.ownerDocument;
9155
+
9156
+ if ( !doc ) {
9157
+ return null;
9158
+ }
9159
+
9160
+ if ( elem === doc.body ) {
9161
+ return jQuery.offset.bodyOffset( elem );
9162
+ }
9163
+
9164
+ return getOffset( elem, doc, doc.documentElement );
9165
+ };
9166
+
9016
9167
  jQuery.offset = {
9017
9168
 
9018
9169
  bodyOffset: function( body ) {
@@ -9118,42 +9269,30 @@ jQuery.fn.extend({
9118
9269
 
9119
9270
 
9120
9271
  // Create scrollLeft and scrollTop methods
9121
- jQuery.each( ["Left", "Top"], function( i, name ) {
9122
- var method = "scroll" + name;
9272
+ jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
9273
+ var top = /Y/.test( prop );
9123
9274
 
9124
9275
  jQuery.fn[ method ] = function( val ) {
9125
- var elem, win;
9276
+ return jQuery.access( this, function( elem, method, val ) {
9277
+ var win = getWindow( elem );
9126
9278
 
9127
- if ( val === undefined ) {
9128
- elem = this[ 0 ];
9129
-
9130
- if ( !elem ) {
9131
- return null;
9279
+ if ( val === undefined ) {
9280
+ return win ? (prop in win) ? win[ prop ] :
9281
+ jQuery.support.boxModel && win.document.documentElement[ method ] ||
9282
+ win.document.body[ method ] :
9283
+ elem[ method ];
9132
9284
  }
9133
9285
 
9134
- win = getWindow( elem );
9135
-
9136
- // Return the scroll offset
9137
- return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
9138
- jQuery.support.boxModel && win.document.documentElement[ method ] ||
9139
- win.document.body[ method ] :
9140
- elem[ method ];
9141
- }
9142
-
9143
- // Set the scroll offset
9144
- return this.each(function() {
9145
- win = getWindow( this );
9146
-
9147
9286
  if ( win ) {
9148
9287
  win.scrollTo(
9149
- !i ? val : jQuery( win ).scrollLeft(),
9150
- i ? val : jQuery( win ).scrollTop()
9288
+ !top ? val : jQuery( win ).scrollLeft(),
9289
+ top ? val : jQuery( win ).scrollTop()
9151
9290
  );
9152
9291
 
9153
9292
  } else {
9154
- this[ method ] = val;
9293
+ elem[ method ] = val;
9155
9294
  }
9156
- });
9295
+ }, method, val, arguments.length, null );
9157
9296
  };
9158
9297
  });
9159
9298
 
@@ -9169,9 +9308,10 @@ function getWindow( elem ) {
9169
9308
 
9170
9309
 
9171
9310
  // Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
9172
- jQuery.each([ "Height", "Width" ], function( i, name ) {
9173
-
9174
- var type = name.toLowerCase();
9311
+ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
9312
+ var clientProp = "client" + name,
9313
+ scrollProp = "scroll" + name,
9314
+ offsetProp = "offset" + name;
9175
9315
 
9176
9316
  // innerHeight and innerWidth
9177
9317
  jQuery.fn[ "inner" + name ] = function() {
@@ -9193,50 +9333,48 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
9193
9333
  null;
9194
9334
  };
9195
9335
 
9196
- jQuery.fn[ type ] = function( size ) {
9197
- // Get window width or height
9198
- var elem = this[0];
9199
- if ( !elem ) {
9200
- return size == null ? null : this;
9201
- }
9336
+ jQuery.fn[ type ] = function( value ) {
9337
+ return jQuery.access( this, function( elem, type, value ) {
9338
+ var doc, docElemProp, orig, ret;
9202
9339
 
9203
- if ( jQuery.isFunction( size ) ) {
9204
- return this.each(function( i ) {
9205
- var self = jQuery( this );
9206
- self[ type ]( size.call( this, i, self[ type ]() ) );
9207
- });
9208
- }
9340
+ if ( jQuery.isWindow( elem ) ) {
9341
+ // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
9342
+ doc = elem.document;
9343
+ docElemProp = doc.documentElement[ clientProp ];
9344
+ return jQuery.support.boxModel && docElemProp ||
9345
+ doc.body && doc.body[ clientProp ] || docElemProp;
9346
+ }
9209
9347
 
9210
- if ( jQuery.isWindow( elem ) ) {
9211
- // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
9212
- // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
9213
- var docElemProp = elem.document.documentElement[ "client" + name ],
9214
- body = elem.document.body;
9215
- return elem.document.compatMode === "CSS1Compat" && docElemProp ||
9216
- body && body[ "client" + name ] || docElemProp;
9217
-
9218
- // Get document width or height
9219
- } else if ( elem.nodeType === 9 ) {
9220
- // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
9221
- return Math.max(
9222
- elem.documentElement["client" + name],
9223
- elem.body["scroll" + name], elem.documentElement["scroll" + name],
9224
- elem.body["offset" + name], elem.documentElement["offset" + name]
9225
- );
9348
+ // Get document width or height
9349
+ if ( elem.nodeType === 9 ) {
9350
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
9351
+ doc = elem.documentElement;
9226
9352
 
9227
- // Get or set width or height on the element
9228
- } else if ( size === undefined ) {
9229
- var orig = jQuery.css( elem, type ),
9230
- ret = parseFloat( orig );
9353
+ // when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height]
9354
+ // so we can't use max, as it'll choose the incorrect offset[Width/Height]
9355
+ // instead we use the correct client[Width/Height]
9356
+ // support:IE6
9357
+ if ( doc[ clientProp ] >= doc[ scrollProp ] ) {
9358
+ return doc[ clientProp ];
9359
+ }
9360
+
9361
+ return Math.max(
9362
+ elem.body[ scrollProp ], doc[ scrollProp ],
9363
+ elem.body[ offsetProp ], doc[ offsetProp ]
9364
+ );
9365
+ }
9231
9366
 
9232
- return jQuery.isNumeric( ret ) ? ret : orig;
9367
+ // Get width or height on the element
9368
+ if ( value === undefined ) {
9369
+ orig = jQuery.css( elem, type );
9370
+ ret = parseFloat( orig );
9371
+ return jQuery.isNumeric( ret ) ? ret : orig;
9372
+ }
9233
9373
 
9234
- // Set the width or height on the element (default to pixels if value is unitless)
9235
- } else {
9236
- return this.css( type, typeof size === "string" ? size : size + "px" );
9237
- }
9374
+ // Set the width or height on the element
9375
+ jQuery( elem ).css( type, value );
9376
+ }, type, value, arguments.length, null );
9238
9377
  };
9239
-
9240
9378
  });
9241
9379
 
9242
9380