r91845 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91844‎ | r91845 | r91846 >
Date:21:17, 10 July 2011
Author:krinkle
Status:ok (Comments)
Tags:
Comment:
Update jQuery from 1.6.1 to 1.6.2 (maintenance/bugfix release)
* Release notes: http://blog.jquery.com/2011/06/30/jquery-162-released/
* Source: http://code.jquery.com/jquery-1.6.2.js
* Requested in bug 29773
Modified paths:
  • /trunk/phase3/resources/jquery/jquery.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery/jquery.js
@@ -1,5 +1,5 @@
22 /*!
3 - * jQuery JavaScript Library v1.6.1
 3+ * jQuery JavaScript Library v1.6.2
44 * http://jquery.com/
55 *
66 * Copyright 2011, John Resig
@@ -11,7 +11,7 @@
1212 * Copyright 2011, The Dojo Foundation
1313 * Released under the MIT, BSD, and GPL Licenses.
1414 *
15 - * Date: Thu May 12 15:04:36 2011 -0400
 15+ * Date: Thu Jun 30 14:16:56 2011 -0400
1616 */
1717 (function( window, undefined ) {
1818
@@ -65,6 +65,14 @@
6666 rmsie = /(msie) ([\w.]+)/,
6767 rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
6868
 69+ // Matches dashed string for camelizing
 70+ rdashAlpha = /-([a-z])/ig,
 71+
 72+ // Used by jQuery.camelCase as callback to replace()
 73+ fcamelCase = function( all, letter ) {
 74+ return letter.toUpperCase();
 75+ },
 76+
6977 // Keep a UserAgent string for use with jQuery.browser
7078 userAgent = navigator.userAgent,
7179
@@ -204,7 +212,7 @@
205213 selector: "",
206214
207215 // The current version of jQuery being used
208 - jquery: "1.6.1",
 216+ jquery: "1.6.2",
209217
210218 // The default length of a jQuery object is 0
211219 length: 0,
@@ -603,6 +611,12 @@
604612 }
605613 },
606614
 615+ // Converts a dashed string to camelCased string;
 616+ // Used by both the css and data modules
 617+ camelCase: function( string ) {
 618+ return string.replace( rdashAlpha, fcamelCase );
 619+ },
 620+
607621 nodeName: function( elem, name ) {
608622 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
609623 },
@@ -799,7 +813,7 @@
800814 },
801815
802816 // Mutifunctional method to get and set values to a collection
803 - // The value/s can be optionally by executed if its a function
 817+ // The value/s can optionally be executed if it's a function
804818 access: function( elems, key, value, exec, fn, pass ) {
805819 var length = elems.length;
806820
@@ -930,7 +944,6 @@
931945 jQuery.ready();
932946 }
933947
934 -// Expose jQuery to the global object
935948 return jQuery;
936949
937950 })();
@@ -1147,7 +1160,9 @@
11481161 support,
11491162 fragment,
11501163 body,
1151 - bodyStyle,
 1164+ testElementParent,
 1165+ testElement,
 1166+ testElementStyle,
11521167 tds,
11531168 events,
11541169 eventName,
@@ -1241,11 +1256,10 @@
12421257 }
12431258
12441259 if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
1245 - div.attachEvent( "onclick", function click() {
 1260+ div.attachEvent( "onclick", function() {
12461261 // Cloning a node shouldn't copy over any
12471262 // bound event handlers (IE does this)
12481263 support.noCloneEvent = false;
1249 - div.detachEvent( "onclick", click );
12501264 });
12511265 div.cloneNode( true ).fireEvent( "onclick" );
12521266 }
@@ -1270,22 +1284,30 @@
12711285 // Figure out if the W3C box model works as expected
12721286 div.style.width = div.style.paddingLeft = "1px";
12731287
1274 - // We use our own, invisible, body
1275 - body = document.createElement( "body" );
1276 - bodyStyle = {
 1288+ body = document.getElementsByTagName( "body" )[ 0 ];
 1289+ // We use our own, invisible, body unless the body is already present
 1290+ // in which case we use a div (#9239)
 1291+ testElement = document.createElement( body ? "div" : "body" );
 1292+ testElementStyle = {
12771293 visibility: "hidden",
12781294 width: 0,
12791295 height: 0,
12801296 border: 0,
1281 - margin: 0,
1282 - // Set background to avoid IE crashes when removing (#9028)
1283 - background: "none"
 1297+ margin: 0
12841298 };
1285 - for ( i in bodyStyle ) {
1286 - body.style[ i ] = bodyStyle[ i ];
 1299+ if ( body ) {
 1300+ jQuery.extend( testElementStyle, {
 1301+ position: "absolute",
 1302+ left: -1000,
 1303+ top: -1000
 1304+ });
12871305 }
1288 - body.appendChild( div );
1289 - documentElement.insertBefore( body, documentElement.firstChild );
 1306+ for ( i in testElementStyle ) {
 1307+ testElement.style[ i ] = testElementStyle[ i ];
 1308+ }
 1309+ testElement.appendChild( div );
 1310+ testElementParent = body || documentElement;
 1311+ testElementParent.insertBefore( testElement, testElementParent.firstChild );
12901312
12911313 // Check if a disconnected checkbox will retain its checked
12921314 // value of true after appended to the DOM (IE6/7)
@@ -1344,8 +1366,8 @@
13451367 }
13461368
13471369 // Remove the body element we added
1348 - body.innerHTML = "";
1349 - documentElement.removeChild( body );
 1370+ testElement.innerHTML = "";
 1371+ testElementParent.removeChild( testElement );
13501372
13511373 // Technique from Juriy Zaytsev
13521374 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
@@ -1369,6 +1391,9 @@
13701392 }
13711393 }
13721394
 1395+ // Null connected elements to avoid leaks in IE
 1396+ testElement = fragment = select = opt = body = marginDiv = div = input = null;
 1397+
13731398 return support;
13741399 })();
13751400
@@ -1486,7 +1511,10 @@
14871512 return thisCache[ internalKey ] && thisCache[ internalKey ].events;
14881513 }
14891514
1490 - return getByName ? thisCache[ jQuery.camelCase( name ) ] : thisCache;
 1515+ return getByName ?
 1516+ // Check for both converted-to-camel and non-converted data property names
 1517+ thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] :
 1518+ thisCache;
14911519 },
14921520
14931521 removeData: function( elem, name, pvt /* Internal Use Only */ ) {
@@ -1882,7 +1910,7 @@
18831911 rfocusable = /^(?:button|input|object|select|textarea)$/i,
18841912 rclickable = /^a(?:rea)?$/i,
18851913 rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
1886 - rinvalidChar = /\:/,
 1914+ rinvalidChar = /\:|^on/,
18871915 formHook, boolHook;
18881916
18891917 jQuery.fn.extend({
@@ -1912,30 +1940,31 @@
19131941 },
19141942
19151943 addClass: function( value ) {
 1944+ var classNames, i, l, elem,
 1945+ setClass, c, cl;
 1946+
19161947 if ( jQuery.isFunction( value ) ) {
1917 - return this.each(function(i) {
1918 - var self = jQuery(this);
1919 - self.addClass( value.call(this, i, self.attr("class") || "") );
 1948+ return this.each(function( j ) {
 1949+ jQuery( this ).addClass( value.call(this, j, this.className) );
19201950 });
19211951 }
19221952
19231953 if ( value && typeof value === "string" ) {
1924 - var classNames = (value || "").split( rspace );
 1954+ classNames = value.split( rspace );
19251955
1926 - for ( var i = 0, l = this.length; i < l; i++ ) {
1927 - var elem = this[i];
 1956+ for ( i = 0, l = this.length; i < l; i++ ) {
 1957+ elem = this[ i ];
19281958
19291959 if ( elem.nodeType === 1 ) {
1930 - if ( !elem.className ) {
 1960+ if ( !elem.className && classNames.length === 1 ) {
19311961 elem.className = value;
19321962
19331963 } else {
1934 - var className = " " + elem.className + " ",
1935 - setClass = elem.className;
 1964+ setClass = " " + elem.className + " ";
19361965
1937 - for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
1938 - if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
1939 - setClass += " " + classNames[c];
 1966+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
 1967+ if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
 1968+ setClass += classNames[ c ] + " ";
19401969 }
19411970 }
19421971 elem.className = jQuery.trim( setClass );
@@ -1948,24 +1977,25 @@
19491978 },
19501979
19511980 removeClass: function( value ) {
1952 - if ( jQuery.isFunction(value) ) {
1953 - return this.each(function(i) {
1954 - var self = jQuery(this);
1955 - self.removeClass( value.call(this, i, self.attr("class")) );
 1981+ var classNames, i, l, elem, className, c, cl;
 1982+
 1983+ if ( jQuery.isFunction( value ) ) {
 1984+ return this.each(function( j ) {
 1985+ jQuery( this ).removeClass( value.call(this, j, this.className) );
19561986 });
19571987 }
19581988
19591989 if ( (value && typeof value === "string") || value === undefined ) {
1960 - var classNames = (value || "").split( rspace );
 1990+ classNames = (value || "").split( rspace );
19611991
1962 - for ( var i = 0, l = this.length; i < l; i++ ) {
1963 - var elem = this[i];
 1992+ for ( i = 0, l = this.length; i < l; i++ ) {
 1993+ elem = this[ i ];
19641994
19651995 if ( elem.nodeType === 1 && elem.className ) {
19661996 if ( value ) {
1967 - var className = (" " + elem.className + " ").replace(rclass, " ");
1968 - for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
1969 - className = className.replace(" " + classNames[c] + " ", " ");
 1997+ className = (" " + elem.className + " ").replace( rclass, " " );
 1998+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
 1999+ className = className.replace(" " + classNames[ c ] + " ", " ");
19702000 }
19712001 elem.className = jQuery.trim( className );
19722002
@@ -1984,9 +2014,8 @@
19852015 isBool = typeof stateVal === "boolean";
19862016
19872017 if ( jQuery.isFunction( value ) ) {
1988 - return this.each(function(i) {
1989 - var self = jQuery(this);
1990 - self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
 2018+ return this.each(function( i ) {
 2019+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
19912020 });
19922021 }
19932022
@@ -2040,7 +2069,13 @@
20412070 return ret;
20422071 }
20432072
2044 - return (elem.value || "").replace(rreturn, "");
 2073+ ret = elem.value;
 2074+
 2075+ return typeof ret === "string" ?
 2076+ // handle most common string cases
 2077+ ret.replace(rreturn, "") :
 2078+ // handle cases where value is null/undef or number
 2079+ ret == null ? "" : ret;
20452080 }
20462081
20472082 return undefined;
@@ -2186,20 +2221,23 @@
21872222 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
21882223
21892224 // Normalize the name if needed
2190 - name = notxml && jQuery.attrFix[ name ] || name;
 2225+ if ( notxml ) {
 2226+ name = jQuery.attrFix[ name ] || name;
21912227
2192 - hooks = jQuery.attrHooks[ name ];
 2228+ hooks = jQuery.attrHooks[ name ];
21932229
2194 - if ( !hooks ) {
2195 - // Use boolHook for boolean attributes
2196 - if ( rboolean.test( name ) &&
2197 - (typeof value === "boolean" || value === undefined || value.toLowerCase() === name.toLowerCase()) ) {
 2230+ if ( !hooks ) {
 2231+ // Use boolHook for boolean attributes
 2232+ if ( rboolean.test( name ) ) {
21982233
2199 - hooks = boolHook;
 2234+ hooks = boolHook;
22002235
2201 - // Use formHook for forms and if the name contains certain characters
2202 - } else if ( formHook && (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
2203 - hooks = formHook;
 2236+ // Use formHook for forms and if the name contains certain characters
 2237+ } else if ( formHook && name !== "className" &&
 2238+ (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
 2239+
 2240+ hooks = formHook;
 2241+ }
22042242 }
22052243 }
22062244
@@ -2217,8 +2255,8 @@
22182256 return value;
22192257 }
22202258
2221 - } else if ( hooks && "get" in hooks && notxml ) {
2222 - return hooks.get( elem, name );
 2259+ } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
 2260+ return ret;
22232261
22242262 } else {
22252263
@@ -2282,6 +2320,25 @@
22832321 0 :
22842322 undefined;
22852323 }
 2324+ },
 2325+ // Use the value property for back compat
 2326+ // Use the formHook for button elements in IE6/7 (#1954)
 2327+ value: {
 2328+ get: function( elem, name ) {
 2329+ if ( formHook && jQuery.nodeName( elem, "button" ) ) {
 2330+ return formHook.get( elem, name );
 2331+ }
 2332+ return name in elem ?
 2333+ elem.value :
 2334+ null;
 2335+ },
 2336+ set: function( elem, value, name ) {
 2337+ if ( formHook && jQuery.nodeName( elem, "button" ) ) {
 2338+ return formHook.set( elem, value, name );
 2339+ }
 2340+ // Does not return so that setAttribute is also used
 2341+ elem.value = value;
 2342+ }
22862343 }
22872344 },
22882345
@@ -2311,10 +2368,11 @@
23122369 var ret, hooks,
23132370 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
23142371
2315 - // Try to normalize/fix the name
2316 - name = notxml && jQuery.propFix[ name ] || name;
2317 -
2318 - hooks = jQuery.propHooks[ name ];
 2372+ if ( notxml ) {
 2373+ // Fix name and attach hooks
 2374+ name = jQuery.propFix[ name ] || name;
 2375+ hooks = jQuery.propHooks[ name ];
 2376+ }
23192377
23202378 if ( value !== undefined ) {
23212379 if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
@@ -2341,7 +2399,7 @@
23422400 boolHook = {
23432401 get: function( elem, name ) {
23442402 // Align boolean attributes with corresponding properties
2345 - return elem[ jQuery.propFix[ name ] || name ] ?
 2403+ return jQuery.prop( elem, name ) ?
23462404 name.toLowerCase() :
23472405 undefined;
23482406 },
@@ -2356,7 +2414,7 @@
23572415 propName = jQuery.propFix[ name ] || name;
23582416 if ( propName in elem ) {
23592417 // Only set the IDL specifically if it already exists on the element
2360 - elem[ propName ] = value;
 2418+ elem[ propName ] = true;
23612419 }
23622420
23632421 elem.setAttribute( name, name.toLowerCase() );
@@ -2365,24 +2423,6 @@
23662424 }
23672425 };
23682426
2369 -// Use the value property for back compat
2370 -// Use the formHook for button elements in IE6/7 (#1954)
2371 -jQuery.attrHooks.value = {
2372 - get: function( elem, name ) {
2373 - if ( formHook && jQuery.nodeName( elem, "button" ) ) {
2374 - return formHook.get( elem, name );
2375 - }
2376 - return elem.value;
2377 - },
2378 - set: function( elem, value, name ) {
2379 - if ( formHook && jQuery.nodeName( elem, "button" ) ) {
2380 - return formHook.set( elem, value, name );
2381 - }
2382 - // Does not return so that setAttribute is also used
2383 - elem.value = value;
2384 - }
2385 -};
2386 -
23872427 // IE6/7 do not support getting/setting some attributes with get/setAttribute
23882428 if ( !jQuery.support.getSetAttribute ) {
23892429
@@ -2390,7 +2430,7 @@
23912431 jQuery.attrFix = jQuery.propFix;
23922432
23932433 // Use this for any attribute on a form in IE6/7
2394 - formHook = jQuery.attrHooks.name = jQuery.valHooks.button = {
 2434+ formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = {
23952435 get: function( elem, name ) {
23962436 var ret;
23972437 ret = elem.getAttributeNode( name );
@@ -2493,8 +2533,7 @@
24942534
24952535
24962536
2497 -var hasOwn = Object.prototype.hasOwnProperty,
2498 - rnamespaces = /\.(.*)$/,
 2537+var rnamespaces = /\.(.*)$/,
24992538 rformElems = /^(?:textarea|input|select)$/i,
25002539 rperiod = /\./g,
25012540 rspaces = / /g,
@@ -2838,7 +2877,7 @@
28392878 event.target = elem;
28402879
28412880 // Clone any incoming data and prepend the event, creating the handler arg list
2842 - data = data ? jQuery.makeArray( data ) : [];
 2881+ data = data != null ? jQuery.makeArray( data ) : [];
28432882 data.unshift( event );
28442883
28452884 var cur = elem,
@@ -3144,34 +3183,27 @@
31453184 // Checks if an event happened on an element within another element
31463185 // Used in jQuery.event.special.mouseenter and mouseleave handlers
31473186 var withinElement = function( event ) {
 3187+
31483188 // Check if mouse(over|out) are still within the same parent element
3149 - var parent = event.relatedTarget;
 3189+ var related = event.relatedTarget,
 3190+ inside = false,
 3191+ eventType = event.type;
31503192
3151 - // set the correct event type
31523193 event.type = event.data;
31533194
3154 - // Firefox sometimes assigns relatedTarget a XUL element
3155 - // which we cannot access the parentNode property of
3156 - try {
 3195+ if ( related !== this ) {
31573196
3158 - // Chrome does something similar, the parentNode property
3159 - // can be accessed but is null.
3160 - if ( parent && parent !== document && !parent.parentNode ) {
3161 - return;
 3197+ if ( related ) {
 3198+ inside = jQuery.contains( this, related );
31623199 }
31633200
3164 - // Traverse up the tree
3165 - while ( parent && parent !== this ) {
3166 - parent = parent.parentNode;
3167 - }
 3201+ if ( !inside ) {
31683202
3169 - if ( parent !== this ) {
3170 - // handle event if we actually just moused on to a non sub-element
31713203 jQuery.event.handle.apply( this, arguments );
 3204+
 3205+ event.type = eventType;
31723206 }
3173 -
3174 - // assuming we've left the element since we most likely mousedover a xul element
3175 - } catch(e) { }
 3207+ }
31763208 },
31773209
31783210 // In case of event delegation, we only need to rename the event.type,
@@ -5890,9 +5922,22 @@
58915923 }
58925924
58935925 jQuery.buildFragment = function( args, nodes, scripts ) {
5894 - var fragment, cacheable, cacheresults,
5895 - doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
 5926+ var fragment, cacheable, cacheresults, doc;
58965927
 5928+ // nodes may contain either an explicit document object,
 5929+ // a jQuery collection or context object.
 5930+ // If nodes[0] contains a valid object to assign to doc
 5931+ if ( nodes && nodes[0] ) {
 5932+ doc = nodes[0].ownerDocument || nodes[0];
 5933+ }
 5934+
 5935+ // Ensure that an attr object doesn't incorrectly stand in as a document object
 5936+ // Chrome and Firefox seem to allow this to occur and will throw exception
 5937+ // Fixes #8950
 5938+ if ( !doc.createDocumentFragment ) {
 5939+ doc = document;
 5940+ }
 5941+
58975942 // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
58985943 // Cloning options loses the selected state, so don't cache them
58995944 // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
@@ -5972,7 +6017,7 @@
59736018 function findInputs( elem ) {
59746019 if ( jQuery.nodeName( elem, "input" ) ) {
59756020 fixDefaultChecked( elem );
5976 - } else if ( elem.getElementsByTagName ) {
 6021+ } else if ( "getElementsByTagName" in elem ) {
59776022 jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
59786023 }
59796024 }
@@ -6021,6 +6066,8 @@
60226067 }
60236068 }
60246069
 6070+ srcElements = destElements = null;
 6071+
60256072 // Return the cloned set
60266073 return clone;
60276074 },
@@ -6201,10 +6248,8 @@
62026249
62036250
62046251
6205 -
62066252 var ralpha = /alpha\([^)]*\)/i,
62076253 ropacity = /opacity=([^)]*)/,
6208 - rdashAlpha = /-([a-z])/ig,
62096254 // fixed for IE9, see #8346
62106255 rupper = /([A-Z]|^ms)/g,
62116256 rnumpx = /^-?\d+(?:px)?$/i,
@@ -6218,12 +6263,8 @@
62196264 curCSS,
62206265
62216266 getComputedStyle,
6222 - currentStyle,
 6267+ currentStyle;
62236268
6224 - fcamelCase = function( all, letter ) {
6225 - return letter.toUpperCase();
6226 - };
6227 -
62286269 jQuery.fn.css = function( name, value ) {
62296270 // Setting 'undefined' is a no-op
62306271 if ( arguments.length === 2 && value === undefined ) {
@@ -6257,13 +6298,14 @@
62586299
62596300 // Exclude the following css properties to add px
62606301 cssNumber: {
6261 - "zIndex": true,
 6302+ "fillOpacity": true,
62626303 "fontWeight": true,
 6304+ "lineHeight": true,
62636305 "opacity": true,
6264 - "zoom": true,
6265 - "lineHeight": true,
 6306+ "orphans": true,
62666307 "widows": true,
6267 - "orphans": true
 6308+ "zIndex": true,
 6309+ "zoom": true
62686310 },
62696311
62706312 // Add in properties whose names you wish to fix before
@@ -6298,6 +6340,8 @@
62996341 // convert relative number strings (+= or -=) to relative numbers. #7345
63006342 if ( type === "string" && rrelNum.test( value ) ) {
63016343 value = +value.replace( rrelNumFilter, "" ) + parseFloat( jQuery.css( elem, name ) );
 6344+ // Fixes bug #9237
 6345+ type = "number";
63026346 }
63036347
63046348 // If a number was passed in, add 'px' to the (except for certain CSS properties)
@@ -6364,10 +6408,6 @@
63656409 for ( name in options ) {
63666410 elem.style[ name ] = old[ name ];
63676411 }
6368 - },
6369 -
6370 - camelCase: function( string ) {
6371 - return string.replace( rdashAlpha, fcamelCase );
63726412 }
63736413 });
63746414
@@ -6381,44 +6421,21 @@
63826422
63836423 if ( computed ) {
63846424 if ( elem.offsetWidth !== 0 ) {
6385 - val = getWH( elem, name, extra );
6386 -
 6425+ return getWH( elem, name, extra );
63876426 } else {
63886427 jQuery.swap( elem, cssShow, function() {
63896428 val = getWH( elem, name, extra );
63906429 });
63916430 }
63926431
6393 - if ( val <= 0 ) {
6394 - val = curCSS( elem, name, name );
6395 -
6396 - if ( val === "0px" && currentStyle ) {
6397 - val = currentStyle( elem, name, name );
6398 - }
6399 -
6400 - if ( val != null ) {
6401 - // Should return "auto" instead of 0, use 0 for
6402 - // temporary backwards-compat
6403 - return val === "" || val === "auto" ? "0px" : val;
6404 - }
6405 - }
6406 -
6407 - if ( val < 0 || val == null ) {
6408 - val = elem.style[ name ];
6409 -
6410 - // Should return "auto" instead of 0, use 0 for
6411 - // temporary backwards-compat
6412 - return val === "" || val === "auto" ? "0px" : val;
6413 - }
6414 -
6415 - return typeof val === "string" ? val : val + "px";
 6432+ return val;
64166433 }
64176434 },
64186435
64196436 set: function( elem, value ) {
64206437 if ( rnumpx.test( value ) ) {
64216438 // ignore negative width and height values #1599
6422 - value = parseFloat(value);
 6439+ value = parseFloat( value );
64236440
64246441 if ( value >= 0 ) {
64256442 return value + "px";
@@ -6541,27 +6558,50 @@
65426559 curCSS = getComputedStyle || currentStyle;
65436560
65446561 function getWH( elem, name, extra ) {
6545 - var which = name === "width" ? cssWidth : cssHeight,
6546 - val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
65476562
6548 - if ( extra === "border" ) {
6549 - return val;
6550 - }
 6563+ // Start with offset property
 6564+ var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
 6565+ which = name === "width" ? cssWidth : cssHeight;
65516566
6552 - jQuery.each( which, function() {
6553 - if ( !extra ) {
6554 - val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
 6567+ if ( val > 0 ) {
 6568+ if ( extra !== "border" ) {
 6569+ jQuery.each( which, function() {
 6570+ if ( !extra ) {
 6571+ val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
 6572+ }
 6573+ if ( extra === "margin" ) {
 6574+ val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
 6575+ } else {
 6576+ val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
 6577+ }
 6578+ });
65556579 }
65566580
6557 - if ( extra === "margin" ) {
6558 - val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
 6581+ return val + "px";
 6582+ }
65596583
6560 - } else {
6561 - val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
6562 - }
6563 - });
 6584+ // Fall back to computed then uncomputed css if necessary
 6585+ val = curCSS( elem, name, name );
 6586+ if ( val < 0 || val == null ) {
 6587+ val = elem.style[ name ] || 0;
 6588+ }
 6589+ // Normalize "", auto, and prepare for extra
 6590+ val = parseFloat( val ) || 0;
65646591
6565 - return val;
 6592+ // Add padding, border, margin
 6593+ if ( extra ) {
 6594+ jQuery.each( which, function() {
 6595+ val += parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
 6596+ if ( extra !== "padding" ) {
 6597+ val += parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
 6598+ }
 6599+ if ( extra === "margin" ) {
 6600+ val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
 6601+ }
 6602+ });
 6603+ }
 6604+
 6605+ return val + "px";
65666606 }
65676607
65686608 if ( jQuery.expr && jQuery.expr.filters ) {
@@ -7957,8 +7997,8 @@
79587998 ],
79597999 fxNow,
79608000 requestAnimationFrame = window.webkitRequestAnimationFrame ||
7961 - window.mozRequestAnimationFrame ||
7962 - window.oRequestAnimationFrame;
 8001+ window.mozRequestAnimationFrame ||
 8002+ window.oRequestAnimationFrame;
79638003
79648004 jQuery.fn.extend({
79658005 show: function( speed, easing, callback ) {
@@ -8272,15 +8312,15 @@
82738313 // Queueing
82748314 opt.old = opt.complete;
82758315 opt.complete = function( noUnmark ) {
 8316+ if ( jQuery.isFunction( opt.old ) ) {
 8317+ opt.old.call( this );
 8318+ }
 8319+
82768320 if ( opt.queue !== false ) {
82778321 jQuery.dequeue( this );
82788322 } else if ( noUnmark !== false ) {
82798323 jQuery._unmark( this );
82808324 }
8281 -
8282 - if ( jQuery.isFunction( opt.old ) ) {
8283 - opt.old.call( this );
8284 - }
82858325 };
82868326
82878327 return opt;
@@ -8353,7 +8393,7 @@
83548394 if ( t() && jQuery.timers.push(t) && !timerId ) {
83558395 // Use requestAnimationFrame instead of setInterval if available
83568396 if ( requestAnimationFrame ) {
8357 - timerId = 1;
 8397+ timerId = true;
83588398 raf = function() {
83598399 // When timerId gets set to null at any point, this stops
83608400 if ( timerId ) {
@@ -8516,7 +8556,8 @@
85178557
85188558 if ( !elemdisplay[ nodeName ] ) {
85198559
8520 - var elem = jQuery( "<" + nodeName + ">" ).appendTo( "body" ),
 8560+ var body = document.body,
 8561+ elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
85218562 display = elem.css( "display" );
85228563
85238564 elem.remove();
@@ -8530,14 +8571,15 @@
85318572 iframe.frameBorder = iframe.width = iframe.height = 0;
85328573 }
85338574
8534 - document.body.appendChild( iframe );
 8575+ body.appendChild( iframe );
85358576
85368577 // Create a cacheable copy of the iframe document on first call.
8537 - // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake html
8538 - // document to it, Webkit & Firefox won't allow reusing the iframe document
 8578+ // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
 8579+ // document to it; WebKit & Firefox won't allow reusing the iframe document.
85398580 if ( !iframeDoc || !iframe.createElement ) {
85408581 iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
8541 - iframeDoc.write( "<!doctype><html><body></body></html>" );
 8582+ iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
 8583+ iframeDoc.close();
85428584 }
85438585
85448586 elem = iframeDoc.createElement( nodeName );
@@ -8546,7 +8588,7 @@
85478589
85488590 display = jQuery.css( elem, "display" );
85498591
8550 - document.body.removeChild( iframe );
 8592+ body.removeChild( iframe );
85518593 }
85528594
85538595 // Store the correct default display
@@ -8867,22 +8909,24 @@
88688910
88698911
88708912
8871 -// Create innerHeight, innerWidth, outerHeight and outerWidth methods
 8913+// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
88728914 jQuery.each([ "Height", "Width" ], function( i, name ) {
88738915
88748916 var type = name.toLowerCase();
88758917
88768918 // innerHeight and innerWidth
8877 - jQuery.fn["inner" + name] = function() {
8878 - return this[0] ?
8879 - parseFloat( jQuery.css( this[0], type, "padding" ) ) :
 8919+ jQuery.fn[ "inner" + name ] = function() {
 8920+ var elem = this[0];
 8921+ return elem && elem.style ?
 8922+ parseFloat( jQuery.css( elem, type, "padding" ) ) :
88808923 null;
88818924 };
88828925
88838926 // outerHeight and outerWidth
8884 - jQuery.fn["outer" + name] = function( margin ) {
8885 - return this[0] ?
8886 - parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
 8927+ jQuery.fn[ "outer" + name ] = function( margin ) {
 8928+ var elem = this[0];
 8929+ return elem && elem.style ?
 8930+ parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
88878931 null;
88888932 };
88898933
@@ -8932,5 +8976,6 @@
89338977 });
89348978
89358979
 8980+// Expose jQuery to the global object
89368981 window.jQuery = window.$ = jQuery;
89378982 })(window);
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r91851Amend RELEASE-NOTES-1.19 for r91845reedy23:26, 10 July 2011
r92349MFT to REL1_18...hashar09:11, 16 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r89853Added jquery.qunit.completenessTest.js (A jQuery/QUnit test coverage utility)...krinkle22:15, 10 June 2011

Comments

#Comment by Reedy (talk | contribs)   21:48, 10 July 2011

Should probably add/update the RELEASE-NOTES to notify of the change :)

#Comment by Krinkle (talk | contribs)   23:31, 10 July 2011

Thx

#Comment by Brion VIBBER (talk | contribs)   00:18, 12 July 2011

Doesn't break any tests, yay. :)

Marking for merge to 1.18; no reason to pump out an old ver there.

#Comment by Reedy (talk | contribs)   00:26, 12 July 2011

Need to merge out the 1.6.1 revs to 1.18 tooo, which is r89853

Status & tagging log