jquery-rails 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

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.6.1
2
+ * jQuery JavaScript Library v1.6.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: Thu May 12 15:04:36 2011 -0400
14
+ * Date: Thu Jun 30 14:16:56 2011 -0400
15
15
  */
16
16
  (function( window, undefined ) {
17
17
 
@@ -65,6 +65,14 @@ var jQuery = function( selector, context ) {
65
65
  rmsie = /(msie) ([\w.]+)/,
66
66
  rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
67
67
 
68
+ // Matches dashed string for camelizing
69
+ rdashAlpha = /-([a-z])/ig,
70
+
71
+ // Used by jQuery.camelCase as callback to replace()
72
+ fcamelCase = function( all, letter ) {
73
+ return letter.toUpperCase();
74
+ },
75
+
68
76
  // Keep a UserAgent string for use with jQuery.browser
69
77
  userAgent = navigator.userAgent,
70
78
 
@@ -204,7 +212,7 @@ jQuery.fn = jQuery.prototype = {
204
212
  selector: "",
205
213
 
206
214
  // The current version of jQuery being used
207
- jquery: "1.6.1",
215
+ jquery: "1.6.2",
208
216
 
209
217
  // The default length of a jQuery object is 0
210
218
  length: 0,
@@ -603,6 +611,12 @@ jQuery.extend({
603
611
  }
604
612
  },
605
613
 
614
+ // Converts a dashed string to camelCased string;
615
+ // Used by both the css and data modules
616
+ camelCase: function( string ) {
617
+ return string.replace( rdashAlpha, fcamelCase );
618
+ },
619
+
606
620
  nodeName: function( elem, name ) {
607
621
  return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
608
622
  },
@@ -799,7 +813,7 @@ jQuery.extend({
799
813
  },
800
814
 
801
815
  // Mutifunctional method to get and set values to a collection
802
- // The value/s can be optionally by executed if its a function
816
+ // The value/s can optionally be executed if it's a function
803
817
  access: function( elems, key, value, exec, fn, pass ) {
804
818
  var length = elems.length;
805
819
 
@@ -930,7 +944,6 @@ function doScrollCheck() {
930
944
  jQuery.ready();
931
945
  }
932
946
 
933
- // Expose jQuery to the global object
934
947
  return jQuery;
935
948
 
936
949
  })();
@@ -1147,7 +1160,9 @@ jQuery.support = (function() {
1147
1160
  support,
1148
1161
  fragment,
1149
1162
  body,
1150
- bodyStyle,
1163
+ testElementParent,
1164
+ testElement,
1165
+ testElementStyle,
1151
1166
  tds,
1152
1167
  events,
1153
1168
  eventName,
@@ -1241,11 +1256,10 @@ jQuery.support = (function() {
1241
1256
  }
1242
1257
 
1243
1258
  if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
1244
- div.attachEvent( "onclick", function click() {
1259
+ div.attachEvent( "onclick", function() {
1245
1260
  // Cloning a node shouldn't copy over any
1246
1261
  // bound event handlers (IE does this)
1247
1262
  support.noCloneEvent = false;
1248
- div.detachEvent( "onclick", click );
1249
1263
  });
1250
1264
  div.cloneNode( true ).fireEvent( "onclick" );
1251
1265
  }
@@ -1270,22 +1284,30 @@ jQuery.support = (function() {
1270
1284
  // Figure out if the W3C box model works as expected
1271
1285
  div.style.width = div.style.paddingLeft = "1px";
1272
1286
 
1273
- // We use our own, invisible, body
1274
- body = document.createElement( "body" );
1275
- bodyStyle = {
1287
+ body = document.getElementsByTagName( "body" )[ 0 ];
1288
+ // We use our own, invisible, body unless the body is already present
1289
+ // in which case we use a div (#9239)
1290
+ testElement = document.createElement( body ? "div" : "body" );
1291
+ testElementStyle = {
1276
1292
  visibility: "hidden",
1277
1293
  width: 0,
1278
1294
  height: 0,
1279
1295
  border: 0,
1280
- margin: 0,
1281
- // Set background to avoid IE crashes when removing (#9028)
1282
- background: "none"
1296
+ margin: 0
1283
1297
  };
1284
- for ( i in bodyStyle ) {
1285
- body.style[ i ] = bodyStyle[ i ];
1298
+ if ( body ) {
1299
+ jQuery.extend( testElementStyle, {
1300
+ position: "absolute",
1301
+ left: -1000,
1302
+ top: -1000
1303
+ });
1304
+ }
1305
+ for ( i in testElementStyle ) {
1306
+ testElement.style[ i ] = testElementStyle[ i ];
1286
1307
  }
1287
- body.appendChild( div );
1288
- documentElement.insertBefore( body, documentElement.firstChild );
1308
+ testElement.appendChild( div );
1309
+ testElementParent = body || documentElement;
1310
+ testElementParent.insertBefore( testElement, testElementParent.firstChild );
1289
1311
 
1290
1312
  // Check if a disconnected checkbox will retain its checked
1291
1313
  // value of true after appended to the DOM (IE6/7)
@@ -1344,8 +1366,8 @@ jQuery.support = (function() {
1344
1366
  }
1345
1367
 
1346
1368
  // Remove the body element we added
1347
- body.innerHTML = "";
1348
- documentElement.removeChild( body );
1369
+ testElement.innerHTML = "";
1370
+ testElementParent.removeChild( testElement );
1349
1371
 
1350
1372
  // Technique from Juriy Zaytsev
1351
1373
  // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
@@ -1369,6 +1391,9 @@ jQuery.support = (function() {
1369
1391
  }
1370
1392
  }
1371
1393
 
1394
+ // Null connected elements to avoid leaks in IE
1395
+ testElement = fragment = select = opt = body = marginDiv = div = input = null;
1396
+
1372
1397
  return support;
1373
1398
  })();
1374
1399
 
@@ -1486,7 +1511,10 @@ jQuery.extend({
1486
1511
  return thisCache[ internalKey ] && thisCache[ internalKey ].events;
1487
1512
  }
1488
1513
 
1489
- return getByName ? thisCache[ jQuery.camelCase( name ) ] : thisCache;
1514
+ return getByName ?
1515
+ // Check for both converted-to-camel and non-converted data property names
1516
+ thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] :
1517
+ thisCache;
1490
1518
  },
1491
1519
 
1492
1520
  removeData: function( elem, name, pvt /* Internal Use Only */ ) {
@@ -1882,7 +1910,7 @@ var rclass = /[\n\t\r]/g,
1882
1910
  rfocusable = /^(?:button|input|object|select|textarea)$/i,
1883
1911
  rclickable = /^a(?:rea)?$/i,
1884
1912
  rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
1885
- rinvalidChar = /\:/,
1913
+ rinvalidChar = /\:|^on/,
1886
1914
  formHook, boolHook;
1887
1915
 
1888
1916
  jQuery.fn.extend({
@@ -1912,30 +1940,31 @@ jQuery.fn.extend({
1912
1940
  },
1913
1941
 
1914
1942
  addClass: function( value ) {
1943
+ var classNames, i, l, elem,
1944
+ setClass, c, cl;
1945
+
1915
1946
  if ( jQuery.isFunction( value ) ) {
1916
- return this.each(function(i) {
1917
- var self = jQuery(this);
1918
- self.addClass( value.call(this, i, self.attr("class") || "") );
1947
+ return this.each(function( j ) {
1948
+ jQuery( this ).addClass( value.call(this, j, this.className) );
1919
1949
  });
1920
1950
  }
1921
1951
 
1922
1952
  if ( value && typeof value === "string" ) {
1923
- var classNames = (value || "").split( rspace );
1953
+ classNames = value.split( rspace );
1924
1954
 
1925
- for ( var i = 0, l = this.length; i < l; i++ ) {
1926
- var elem = this[i];
1955
+ for ( i = 0, l = this.length; i < l; i++ ) {
1956
+ elem = this[ i ];
1927
1957
 
1928
1958
  if ( elem.nodeType === 1 ) {
1929
- if ( !elem.className ) {
1959
+ if ( !elem.className && classNames.length === 1 ) {
1930
1960
  elem.className = value;
1931
1961
 
1932
1962
  } else {
1933
- var className = " " + elem.className + " ",
1934
- setClass = elem.className;
1963
+ setClass = " " + elem.className + " ";
1935
1964
 
1936
- for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
1937
- if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
1938
- setClass += " " + classNames[c];
1965
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
1966
+ if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
1967
+ setClass += classNames[ c ] + " ";
1939
1968
  }
1940
1969
  }
1941
1970
  elem.className = jQuery.trim( setClass );
@@ -1948,24 +1977,25 @@ jQuery.fn.extend({
1948
1977
  },
1949
1978
 
1950
1979
  removeClass: function( value ) {
1951
- if ( jQuery.isFunction(value) ) {
1952
- return this.each(function(i) {
1953
- var self = jQuery(this);
1954
- self.removeClass( value.call(this, i, self.attr("class")) );
1980
+ var classNames, i, l, elem, className, c, cl;
1981
+
1982
+ if ( jQuery.isFunction( value ) ) {
1983
+ return this.each(function( j ) {
1984
+ jQuery( this ).removeClass( value.call(this, j, this.className) );
1955
1985
  });
1956
1986
  }
1957
1987
 
1958
1988
  if ( (value && typeof value === "string") || value === undefined ) {
1959
- var classNames = (value || "").split( rspace );
1989
+ classNames = (value || "").split( rspace );
1960
1990
 
1961
- for ( var i = 0, l = this.length; i < l; i++ ) {
1962
- var elem = this[i];
1991
+ for ( i = 0, l = this.length; i < l; i++ ) {
1992
+ elem = this[ i ];
1963
1993
 
1964
1994
  if ( elem.nodeType === 1 && elem.className ) {
1965
1995
  if ( value ) {
1966
- var className = (" " + elem.className + " ").replace(rclass, " ");
1967
- for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
1968
- className = className.replace(" " + classNames[c] + " ", " ");
1996
+ className = (" " + elem.className + " ").replace( rclass, " " );
1997
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
1998
+ className = className.replace(" " + classNames[ c ] + " ", " ");
1969
1999
  }
1970
2000
  elem.className = jQuery.trim( className );
1971
2001
 
@@ -1984,9 +2014,8 @@ jQuery.fn.extend({
1984
2014
  isBool = typeof stateVal === "boolean";
1985
2015
 
1986
2016
  if ( jQuery.isFunction( value ) ) {
1987
- return this.each(function(i) {
1988
- var self = jQuery(this);
1989
- self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
2017
+ return this.each(function( i ) {
2018
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
1990
2019
  });
1991
2020
  }
1992
2021
 
@@ -2040,7 +2069,13 @@ jQuery.fn.extend({
2040
2069
  return ret;
2041
2070
  }
2042
2071
 
2043
- return (elem.value || "").replace(rreturn, "");
2072
+ ret = elem.value;
2073
+
2074
+ return typeof ret === "string" ?
2075
+ // handle most common string cases
2076
+ ret.replace(rreturn, "") :
2077
+ // handle cases where value is null/undef or number
2078
+ ret == null ? "" : ret;
2044
2079
  }
2045
2080
 
2046
2081
  return undefined;
@@ -2186,20 +2221,23 @@ jQuery.extend({
2186
2221
  notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
2187
2222
 
2188
2223
  // Normalize the name if needed
2189
- name = notxml && jQuery.attrFix[ name ] || name;
2224
+ if ( notxml ) {
2225
+ name = jQuery.attrFix[ name ] || name;
2190
2226
 
2191
- hooks = jQuery.attrHooks[ name ];
2227
+ hooks = jQuery.attrHooks[ name ];
2192
2228
 
2193
- if ( !hooks ) {
2194
- // Use boolHook for boolean attributes
2195
- if ( rboolean.test( name ) &&
2196
- (typeof value === "boolean" || value === undefined || value.toLowerCase() === name.toLowerCase()) ) {
2229
+ if ( !hooks ) {
2230
+ // Use boolHook for boolean attributes
2231
+ if ( rboolean.test( name ) ) {
2197
2232
 
2198
- hooks = boolHook;
2233
+ hooks = boolHook;
2199
2234
 
2200
- // Use formHook for forms and if the name contains certain characters
2201
- } else if ( formHook && (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
2202
- hooks = formHook;
2235
+ // Use formHook for forms and if the name contains certain characters
2236
+ } else if ( formHook && name !== "className" &&
2237
+ (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
2238
+
2239
+ hooks = formHook;
2240
+ }
2203
2241
  }
2204
2242
  }
2205
2243
 
@@ -2217,8 +2255,8 @@ jQuery.extend({
2217
2255
  return value;
2218
2256
  }
2219
2257
 
2220
- } else if ( hooks && "get" in hooks && notxml ) {
2221
- return hooks.get( elem, name );
2258
+ } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
2259
+ return ret;
2222
2260
 
2223
2261
  } else {
2224
2262
 
@@ -2282,6 +2320,25 @@ jQuery.extend({
2282
2320
  0 :
2283
2321
  undefined;
2284
2322
  }
2323
+ },
2324
+ // Use the value property for back compat
2325
+ // Use the formHook for button elements in IE6/7 (#1954)
2326
+ value: {
2327
+ get: function( elem, name ) {
2328
+ if ( formHook && jQuery.nodeName( elem, "button" ) ) {
2329
+ return formHook.get( elem, name );
2330
+ }
2331
+ return name in elem ?
2332
+ elem.value :
2333
+ null;
2334
+ },
2335
+ set: function( elem, value, name ) {
2336
+ if ( formHook && jQuery.nodeName( elem, "button" ) ) {
2337
+ return formHook.set( elem, value, name );
2338
+ }
2339
+ // Does not return so that setAttribute is also used
2340
+ elem.value = value;
2341
+ }
2285
2342
  }
2286
2343
  },
2287
2344
 
@@ -2311,10 +2368,11 @@ jQuery.extend({
2311
2368
  var ret, hooks,
2312
2369
  notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
2313
2370
 
2314
- // Try to normalize/fix the name
2315
- name = notxml && jQuery.propFix[ name ] || name;
2316
-
2317
- hooks = jQuery.propHooks[ name ];
2371
+ if ( notxml ) {
2372
+ // Fix name and attach hooks
2373
+ name = jQuery.propFix[ name ] || name;
2374
+ hooks = jQuery.propHooks[ name ];
2375
+ }
2318
2376
 
2319
2377
  if ( value !== undefined ) {
2320
2378
  if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
@@ -2341,7 +2399,7 @@ jQuery.extend({
2341
2399
  boolHook = {
2342
2400
  get: function( elem, name ) {
2343
2401
  // Align boolean attributes with corresponding properties
2344
- return elem[ jQuery.propFix[ name ] || name ] ?
2402
+ return jQuery.prop( elem, name ) ?
2345
2403
  name.toLowerCase() :
2346
2404
  undefined;
2347
2405
  },
@@ -2356,7 +2414,7 @@ boolHook = {
2356
2414
  propName = jQuery.propFix[ name ] || name;
2357
2415
  if ( propName in elem ) {
2358
2416
  // Only set the IDL specifically if it already exists on the element
2359
- elem[ propName ] = value;
2417
+ elem[ propName ] = true;
2360
2418
  }
2361
2419
 
2362
2420
  elem.setAttribute( name, name.toLowerCase() );
@@ -2365,24 +2423,6 @@ boolHook = {
2365
2423
  }
2366
2424
  };
2367
2425
 
2368
- // Use the value property for back compat
2369
- // Use the formHook for button elements in IE6/7 (#1954)
2370
- jQuery.attrHooks.value = {
2371
- get: function( elem, name ) {
2372
- if ( formHook && jQuery.nodeName( elem, "button" ) ) {
2373
- return formHook.get( elem, name );
2374
- }
2375
- return elem.value;
2376
- },
2377
- set: function( elem, value, name ) {
2378
- if ( formHook && jQuery.nodeName( elem, "button" ) ) {
2379
- return formHook.set( elem, value, name );
2380
- }
2381
- // Does not return so that setAttribute is also used
2382
- elem.value = value;
2383
- }
2384
- };
2385
-
2386
2426
  // IE6/7 do not support getting/setting some attributes with get/setAttribute
2387
2427
  if ( !jQuery.support.getSetAttribute ) {
2388
2428
 
@@ -2390,7 +2430,7 @@ if ( !jQuery.support.getSetAttribute ) {
2390
2430
  jQuery.attrFix = jQuery.propFix;
2391
2431
 
2392
2432
  // Use this for any attribute on a form in IE6/7
2393
- formHook = jQuery.attrHooks.name = jQuery.valHooks.button = {
2433
+ formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = {
2394
2434
  get: function( elem, name ) {
2395
2435
  var ret;
2396
2436
  ret = elem.getAttributeNode( name );
@@ -2493,8 +2533,7 @@ jQuery.each([ "radio", "checkbox" ], function() {
2493
2533
 
2494
2534
 
2495
2535
 
2496
- var hasOwn = Object.prototype.hasOwnProperty,
2497
- rnamespaces = /\.(.*)$/,
2536
+ var rnamespaces = /\.(.*)$/,
2498
2537
  rformElems = /^(?:textarea|input|select)$/i,
2499
2538
  rperiod = /\./g,
2500
2539
  rspaces = / /g,
@@ -2838,7 +2877,7 @@ jQuery.event = {
2838
2877
  event.target = elem;
2839
2878
 
2840
2879
  // Clone any incoming data and prepend the event, creating the handler arg list
2841
- data = data ? jQuery.makeArray( data ) : [];
2880
+ data = data != null ? jQuery.makeArray( data ) : [];
2842
2881
  data.unshift( event );
2843
2882
 
2844
2883
  var cur = elem,
@@ -3144,34 +3183,27 @@ jQuery.Event.prototype = {
3144
3183
  // Checks if an event happened on an element within another element
3145
3184
  // Used in jQuery.event.special.mouseenter and mouseleave handlers
3146
3185
  var withinElement = function( event ) {
3186
+
3147
3187
  // Check if mouse(over|out) are still within the same parent element
3148
- var parent = event.relatedTarget;
3188
+ var related = event.relatedTarget,
3189
+ inside = false,
3190
+ eventType = event.type;
3149
3191
 
3150
- // set the correct event type
3151
3192
  event.type = event.data;
3152
3193
 
3153
- // Firefox sometimes assigns relatedTarget a XUL element
3154
- // which we cannot access the parentNode property of
3155
- try {
3194
+ if ( related !== this ) {
3156
3195
 
3157
- // Chrome does something similar, the parentNode property
3158
- // can be accessed but is null.
3159
- if ( parent && parent !== document && !parent.parentNode ) {
3160
- return;
3196
+ if ( related ) {
3197
+ inside = jQuery.contains( this, related );
3161
3198
  }
3162
3199
 
3163
- // Traverse up the tree
3164
- while ( parent && parent !== this ) {
3165
- parent = parent.parentNode;
3166
- }
3200
+ if ( !inside ) {
3167
3201
 
3168
- if ( parent !== this ) {
3169
- // handle event if we actually just moused on to a non sub-element
3170
3202
  jQuery.event.handle.apply( this, arguments );
3171
- }
3172
3203
 
3173
- // assuming we've left the element since we most likely mousedover a xul element
3174
- } catch(e) { }
3204
+ event.type = eventType;
3205
+ }
3206
+ }
3175
3207
  },
3176
3208
 
3177
3209
  // In case of event delegation, we only need to rename the event.type,
@@ -5890,8 +5922,21 @@ function cloneFixAttributes( src, dest ) {
5890
5922
  }
5891
5923
 
5892
5924
  jQuery.buildFragment = function( args, nodes, scripts ) {
5893
- var fragment, cacheable, cacheresults,
5894
- doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
5925
+ var fragment, cacheable, cacheresults, doc;
5926
+
5927
+ // nodes may contain either an explicit document object,
5928
+ // a jQuery collection or context object.
5929
+ // If nodes[0] contains a valid object to assign to doc
5930
+ if ( nodes && nodes[0] ) {
5931
+ doc = nodes[0].ownerDocument || nodes[0];
5932
+ }
5933
+
5934
+ // Ensure that an attr object doesn't incorrectly stand in as a document object
5935
+ // Chrome and Firefox seem to allow this to occur and will throw exception
5936
+ // Fixes #8950
5937
+ if ( !doc.createDocumentFragment ) {
5938
+ doc = document;
5939
+ }
5895
5940
 
5896
5941
  // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
5897
5942
  // Cloning options loses the selected state, so don't cache them
@@ -5972,7 +6017,7 @@ function fixDefaultChecked( elem ) {
5972
6017
  function findInputs( elem ) {
5973
6018
  if ( jQuery.nodeName( elem, "input" ) ) {
5974
6019
  fixDefaultChecked( elem );
5975
- } else if ( elem.getElementsByTagName ) {
6020
+ } else if ( "getElementsByTagName" in elem ) {
5976
6021
  jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
5977
6022
  }
5978
6023
  }
@@ -6021,6 +6066,8 @@ jQuery.extend({
6021
6066
  }
6022
6067
  }
6023
6068
 
6069
+ srcElements = destElements = null;
6070
+
6024
6071
  // Return the cloned set
6025
6072
  return clone;
6026
6073
  },
@@ -6201,10 +6248,8 @@ function evalScript( i, elem ) {
6201
6248
 
6202
6249
 
6203
6250
 
6204
-
6205
6251
  var ralpha = /alpha\([^)]*\)/i,
6206
6252
  ropacity = /opacity=([^)]*)/,
6207
- rdashAlpha = /-([a-z])/ig,
6208
6253
  // fixed for IE9, see #8346
6209
6254
  rupper = /([A-Z]|^ms)/g,
6210
6255
  rnumpx = /^-?\d+(?:px)?$/i,
@@ -6218,11 +6263,7 @@ var ralpha = /alpha\([^)]*\)/i,
6218
6263
  curCSS,
6219
6264
 
6220
6265
  getComputedStyle,
6221
- currentStyle,
6222
-
6223
- fcamelCase = function( all, letter ) {
6224
- return letter.toUpperCase();
6225
- };
6266
+ currentStyle;
6226
6267
 
6227
6268
  jQuery.fn.css = function( name, value ) {
6228
6269
  // Setting 'undefined' is a no-op
@@ -6257,13 +6298,14 @@ jQuery.extend({
6257
6298
 
6258
6299
  // Exclude the following css properties to add px
6259
6300
  cssNumber: {
6260
- "zIndex": true,
6301
+ "fillOpacity": true,
6261
6302
  "fontWeight": true,
6262
- "opacity": true,
6263
- "zoom": true,
6264
6303
  "lineHeight": true,
6304
+ "opacity": true,
6305
+ "orphans": true,
6265
6306
  "widows": true,
6266
- "orphans": true
6307
+ "zIndex": true,
6308
+ "zoom": true
6267
6309
  },
6268
6310
 
6269
6311
  // Add in properties whose names you wish to fix before
@@ -6298,6 +6340,8 @@ jQuery.extend({
6298
6340
  // convert relative number strings (+= or -=) to relative numbers. #7345
6299
6341
  if ( type === "string" && rrelNum.test( value ) ) {
6300
6342
  value = +value.replace( rrelNumFilter, "" ) + parseFloat( jQuery.css( elem, name ) );
6343
+ // Fixes bug #9237
6344
+ type = "number";
6301
6345
  }
6302
6346
 
6303
6347
  // If a number was passed in, add 'px' to the (except for certain CSS properties)
@@ -6364,10 +6408,6 @@ jQuery.extend({
6364
6408
  for ( name in options ) {
6365
6409
  elem.style[ name ] = old[ name ];
6366
6410
  }
6367
- },
6368
-
6369
- camelCase: function( string ) {
6370
- return string.replace( rdashAlpha, fcamelCase );
6371
6411
  }
6372
6412
  });
6373
6413
 
@@ -6381,44 +6421,21 @@ jQuery.each(["height", "width"], function( i, name ) {
6381
6421
 
6382
6422
  if ( computed ) {
6383
6423
  if ( elem.offsetWidth !== 0 ) {
6384
- val = getWH( elem, name, extra );
6385
-
6424
+ return getWH( elem, name, extra );
6386
6425
  } else {
6387
6426
  jQuery.swap( elem, cssShow, function() {
6388
6427
  val = getWH( elem, name, extra );
6389
6428
  });
6390
6429
  }
6391
6430
 
6392
- if ( val <= 0 ) {
6393
- val = curCSS( elem, name, name );
6394
-
6395
- if ( val === "0px" && currentStyle ) {
6396
- val = currentStyle( elem, name, name );
6397
- }
6398
-
6399
- if ( val != null ) {
6400
- // Should return "auto" instead of 0, use 0 for
6401
- // temporary backwards-compat
6402
- return val === "" || val === "auto" ? "0px" : val;
6403
- }
6404
- }
6405
-
6406
- if ( val < 0 || val == null ) {
6407
- val = elem.style[ name ];
6408
-
6409
- // Should return "auto" instead of 0, use 0 for
6410
- // temporary backwards-compat
6411
- return val === "" || val === "auto" ? "0px" : val;
6412
- }
6413
-
6414
- return typeof val === "string" ? val : val + "px";
6431
+ return val;
6415
6432
  }
6416
6433
  },
6417
6434
 
6418
6435
  set: function( elem, value ) {
6419
6436
  if ( rnumpx.test( value ) ) {
6420
6437
  // ignore negative width and height values #1599
6421
- value = parseFloat(value);
6438
+ value = parseFloat( value );
6422
6439
 
6423
6440
  if ( value >= 0 ) {
6424
6441
  return value + "px";
@@ -6541,27 +6558,50 @@ if ( document.documentElement.currentStyle ) {
6541
6558
  curCSS = getComputedStyle || currentStyle;
6542
6559
 
6543
6560
  function getWH( elem, name, extra ) {
6544
- var which = name === "width" ? cssWidth : cssHeight,
6545
- val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
6546
6561
 
6547
- if ( extra === "border" ) {
6548
- return val;
6549
- }
6562
+ // Start with offset property
6563
+ var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
6564
+ which = name === "width" ? cssWidth : cssHeight;
6550
6565
 
6551
- jQuery.each( which, function() {
6552
- if ( !extra ) {
6553
- val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
6566
+ if ( val > 0 ) {
6567
+ if ( extra !== "border" ) {
6568
+ jQuery.each( which, function() {
6569
+ if ( !extra ) {
6570
+ val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
6571
+ }
6572
+ if ( extra === "margin" ) {
6573
+ val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
6574
+ } else {
6575
+ val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
6576
+ }
6577
+ });
6554
6578
  }
6555
6579
 
6556
- if ( extra === "margin" ) {
6557
- val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
6580
+ return val + "px";
6581
+ }
6558
6582
 
6559
- } else {
6560
- val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
6561
- }
6562
- });
6583
+ // Fall back to computed then uncomputed css if necessary
6584
+ val = curCSS( elem, name, name );
6585
+ if ( val < 0 || val == null ) {
6586
+ val = elem.style[ name ] || 0;
6587
+ }
6588
+ // Normalize "", auto, and prepare for extra
6589
+ val = parseFloat( val ) || 0;
6590
+
6591
+ // Add padding, border, margin
6592
+ if ( extra ) {
6593
+ jQuery.each( which, function() {
6594
+ val += parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
6595
+ if ( extra !== "padding" ) {
6596
+ val += parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
6597
+ }
6598
+ if ( extra === "margin" ) {
6599
+ val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
6600
+ }
6601
+ });
6602
+ }
6563
6603
 
6564
- return val;
6604
+ return val + "px";
6565
6605
  }
6566
6606
 
6567
6607
  if ( jQuery.expr && jQuery.expr.filters ) {
@@ -7957,8 +7997,8 @@ var elemdisplay = {},
7957
7997
  ],
7958
7998
  fxNow,
7959
7999
  requestAnimationFrame = window.webkitRequestAnimationFrame ||
7960
- window.mozRequestAnimationFrame ||
7961
- window.oRequestAnimationFrame;
8000
+ window.mozRequestAnimationFrame ||
8001
+ window.oRequestAnimationFrame;
7962
8002
 
7963
8003
  jQuery.fn.extend({
7964
8004
  show: function( speed, easing, callback ) {
@@ -8272,15 +8312,15 @@ jQuery.extend({
8272
8312
  // Queueing
8273
8313
  opt.old = opt.complete;
8274
8314
  opt.complete = function( noUnmark ) {
8315
+ if ( jQuery.isFunction( opt.old ) ) {
8316
+ opt.old.call( this );
8317
+ }
8318
+
8275
8319
  if ( opt.queue !== false ) {
8276
8320
  jQuery.dequeue( this );
8277
8321
  } else if ( noUnmark !== false ) {
8278
8322
  jQuery._unmark( this );
8279
8323
  }
8280
-
8281
- if ( jQuery.isFunction( opt.old ) ) {
8282
- opt.old.call( this );
8283
- }
8284
8324
  };
8285
8325
 
8286
8326
  return opt;
@@ -8353,7 +8393,7 @@ jQuery.fx.prototype = {
8353
8393
  if ( t() && jQuery.timers.push(t) && !timerId ) {
8354
8394
  // Use requestAnimationFrame instead of setInterval if available
8355
8395
  if ( requestAnimationFrame ) {
8356
- timerId = 1;
8396
+ timerId = true;
8357
8397
  raf = function() {
8358
8398
  // When timerId gets set to null at any point, this stops
8359
8399
  if ( timerId ) {
@@ -8516,7 +8556,8 @@ function defaultDisplay( nodeName ) {
8516
8556
 
8517
8557
  if ( !elemdisplay[ nodeName ] ) {
8518
8558
 
8519
- var elem = jQuery( "<" + nodeName + ">" ).appendTo( "body" ),
8559
+ var body = document.body,
8560
+ elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
8520
8561
  display = elem.css( "display" );
8521
8562
 
8522
8563
  elem.remove();
@@ -8530,14 +8571,15 @@ function defaultDisplay( nodeName ) {
8530
8571
  iframe.frameBorder = iframe.width = iframe.height = 0;
8531
8572
  }
8532
8573
 
8533
- document.body.appendChild( iframe );
8574
+ body.appendChild( iframe );
8534
8575
 
8535
8576
  // Create a cacheable copy of the iframe document on first call.
8536
- // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake html
8537
- // document to it, Webkit & Firefox won't allow reusing the iframe document
8577
+ // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
8578
+ // document to it; WebKit & Firefox won't allow reusing the iframe document.
8538
8579
  if ( !iframeDoc || !iframe.createElement ) {
8539
8580
  iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
8540
- iframeDoc.write( "<!doctype><html><body></body></html>" );
8581
+ iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
8582
+ iframeDoc.close();
8541
8583
  }
8542
8584
 
8543
8585
  elem = iframeDoc.createElement( nodeName );
@@ -8546,7 +8588,7 @@ function defaultDisplay( nodeName ) {
8546
8588
 
8547
8589
  display = jQuery.css( elem, "display" );
8548
8590
 
8549
- document.body.removeChild( iframe );
8591
+ body.removeChild( iframe );
8550
8592
  }
8551
8593
 
8552
8594
  // Store the correct default display
@@ -8867,22 +8909,24 @@ function getWindow( elem ) {
8867
8909
 
8868
8910
 
8869
8911
 
8870
- // Create innerHeight, innerWidth, outerHeight and outerWidth methods
8912
+ // Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
8871
8913
  jQuery.each([ "Height", "Width" ], function( i, name ) {
8872
8914
 
8873
8915
  var type = name.toLowerCase();
8874
8916
 
8875
8917
  // innerHeight and innerWidth
8876
- jQuery.fn["inner" + name] = function() {
8877
- return this[0] ?
8878
- parseFloat( jQuery.css( this[0], type, "padding" ) ) :
8918
+ jQuery.fn[ "inner" + name ] = function() {
8919
+ var elem = this[0];
8920
+ return elem && elem.style ?
8921
+ parseFloat( jQuery.css( elem, type, "padding" ) ) :
8879
8922
  null;
8880
8923
  };
8881
8924
 
8882
8925
  // outerHeight and outerWidth
8883
- jQuery.fn["outer" + name] = function( margin ) {
8884
- return this[0] ?
8885
- parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
8926
+ jQuery.fn[ "outer" + name ] = function( margin ) {
8927
+ var elem = this[0];
8928
+ return elem && elem.style ?
8929
+ parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
8886
8930
  null;
8887
8931
  };
8888
8932
 
@@ -8932,5 +8976,6 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
8932
8976
  });
8933
8977
 
8934
8978
 
8979
+ // Expose jQuery to the global object
8935
8980
  window.jQuery = window.$ = jQuery;
8936
8981
  })(window);