Index: branches/wmf/1.18wmf1/resources/jquery/jquery.js |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | /*! |
3 | | - * jQuery JavaScript Library v1.6.2 |
| 3 | + * jQuery JavaScript Library v1.6.4 |
4 | 4 | * http://jquery.com/ |
5 | 5 | * |
6 | 6 | * Copyright 2011, John Resig |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | * Copyright 2011, The Dojo Foundation |
13 | 13 | * Released under the MIT, BSD, and GPL Licenses. |
14 | 14 | * |
15 | | - * Date: Thu Jun 30 14:16:56 2011 -0400 |
| 15 | + * Date: Mon Sep 12 18:54:48 2011 -0400 |
16 | 16 | */ |
17 | 17 | (function( window, undefined ) { |
18 | 18 | |
— | — | @@ -37,8 +37,8 @@ |
38 | 38 | rootjQuery, |
39 | 39 | |
40 | 40 | // A simple way to check for HTML strings or ID strings |
41 | | - // (both of which we optimize for) |
42 | | - quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, |
| 41 | + // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) |
| 42 | + quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, |
43 | 43 | |
44 | 44 | // Check if a string has a non-whitespace character in it |
45 | 45 | rnotwhite = /\S/, |
— | — | @@ -66,11 +66,12 @@ |
67 | 67 | rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, |
68 | 68 | |
69 | 69 | // Matches dashed string for camelizing |
70 | | - rdashAlpha = /-([a-z])/ig, |
| 70 | + rdashAlpha = /-([a-z]|[0-9])/ig, |
| 71 | + rmsPrefix = /^-ms-/, |
71 | 72 | |
72 | 73 | // Used by jQuery.camelCase as callback to replace() |
73 | 74 | fcamelCase = function( all, letter ) { |
74 | | - return letter.toUpperCase(); |
| 75 | + return ( letter + "" ).toUpperCase(); |
75 | 76 | }, |
76 | 77 | |
77 | 78 | // Keep a UserAgent string for use with jQuery.browser |
— | — | @@ -212,7 +213,7 @@ |
213 | 214 | selector: "", |
214 | 215 | |
215 | 216 | // The current version of jQuery being used |
216 | | - jquery: "1.6.2", |
| 217 | + jquery: "1.6.4", |
217 | 218 | |
218 | 219 | // The default length of a jQuery object is 0 |
219 | 220 | length: 0, |
— | — | @@ -521,10 +522,15 @@ |
522 | 523 | return false; |
523 | 524 | } |
524 | 525 | |
525 | | - // Not own constructor property must be Object |
526 | | - if ( obj.constructor && |
527 | | - !hasOwn.call(obj, "constructor") && |
528 | | - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { |
| 526 | + try { |
| 527 | + // Not own constructor property must be Object |
| 528 | + if ( obj.constructor && |
| 529 | + !hasOwn.call(obj, "constructor") && |
| 530 | + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { |
| 531 | + return false; |
| 532 | + } |
| 533 | + } catch ( e ) { |
| 534 | + // IE8,9 Will throw exceptions on certain host objects #9897 |
529 | 535 | return false; |
530 | 536 | } |
531 | 537 | |
— | — | @@ -574,24 +580,23 @@ |
575 | 581 | }, |
576 | 582 | |
577 | 583 | // Cross-browser xml parsing |
578 | | - // (xml & tmp used internally) |
579 | | - parseXML: function( data , xml , tmp ) { |
580 | | - |
581 | | - if ( window.DOMParser ) { // Standard |
582 | | - tmp = new DOMParser(); |
583 | | - xml = tmp.parseFromString( data , "text/xml" ); |
584 | | - } else { // IE |
585 | | - xml = new ActiveXObject( "Microsoft.XMLDOM" ); |
586 | | - xml.async = "false"; |
587 | | - xml.loadXML( data ); |
| 584 | + parseXML: function( data ) { |
| 585 | + var xml, tmp; |
| 586 | + try { |
| 587 | + if ( window.DOMParser ) { // Standard |
| 588 | + tmp = new DOMParser(); |
| 589 | + xml = tmp.parseFromString( data , "text/xml" ); |
| 590 | + } else { // IE |
| 591 | + xml = new ActiveXObject( "Microsoft.XMLDOM" ); |
| 592 | + xml.async = "false"; |
| 593 | + xml.loadXML( data ); |
| 594 | + } |
| 595 | + } catch( e ) { |
| 596 | + xml = undefined; |
588 | 597 | } |
589 | | - |
590 | | - tmp = xml.documentElement; |
591 | | - |
592 | | - if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) { |
| 598 | + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { |
593 | 599 | jQuery.error( "Invalid XML: " + data ); |
594 | 600 | } |
595 | | - |
596 | 601 | return xml; |
597 | 602 | }, |
598 | 603 | |
— | — | @@ -611,10 +616,10 @@ |
612 | 617 | } |
613 | 618 | }, |
614 | 619 | |
615 | | - // Converts a dashed string to camelCased string; |
616 | | - // Used by both the css and data modules |
| 620 | + // Convert dashed to camelCase; used by the css and data modules |
| 621 | + // Microsoft forgot to hump their vendor prefix (#9572) |
617 | 622 | camelCase: function( string ) { |
618 | | - return string.replace( rdashAlpha, fcamelCase ); |
| 623 | + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); |
619 | 624 | }, |
620 | 625 | |
621 | 626 | nodeName: function( elem, name ) { |
— | — | @@ -699,6 +704,9 @@ |
700 | 705 | }, |
701 | 706 | |
702 | 707 | inArray: function( elem, array ) { |
| 708 | + if ( !array ) { |
| 709 | + return -1; |
| 710 | + } |
703 | 711 | |
704 | 712 | if ( indexOf ) { |
705 | 713 | return indexOf.call( array, elem ); |
— | — | @@ -1071,7 +1079,7 @@ |
1072 | 1080 | if ( returned && jQuery.isFunction( returned.promise ) ) { |
1073 | 1081 | returned.promise().then( newDefer.resolve, newDefer.reject ); |
1074 | 1082 | } else { |
1075 | | - newDefer[ action ]( returned ); |
| 1083 | + newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); |
1076 | 1084 | } |
1077 | 1085 | }); |
1078 | 1086 | } else { |
— | — | @@ -1173,6 +1181,7 @@ |
1174 | 1182 | div.setAttribute("className", "t"); |
1175 | 1183 | div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; |
1176 | 1184 | |
| 1185 | + |
1177 | 1186 | all = div.getElementsByTagName( "*" ); |
1178 | 1187 | a = div.getElementsByTagName( "a" )[ 0 ]; |
1179 | 1188 | |
— | — | @@ -1293,13 +1302,14 @@ |
1294 | 1303 | width: 0, |
1295 | 1304 | height: 0, |
1296 | 1305 | border: 0, |
1297 | | - margin: 0 |
| 1306 | + margin: 0, |
| 1307 | + background: "none" |
1298 | 1308 | }; |
1299 | 1309 | if ( body ) { |
1300 | 1310 | jQuery.extend( testElementStyle, { |
1301 | 1311 | position: "absolute", |
1302 | | - left: -1000, |
1303 | | - top: -1000 |
| 1312 | + left: "-1000px", |
| 1313 | + top: "-1000px" |
1304 | 1314 | }); |
1305 | 1315 | } |
1306 | 1316 | for ( i in testElementStyle ) { |
— | — | @@ -1404,7 +1414,7 @@ |
1405 | 1415 | |
1406 | 1416 | |
1407 | 1417 | var rbrace = /^(?:\{.*\}|\[.*\])$/, |
1408 | | - rmultiDash = /([a-z])([A-Z])/g; |
| 1418 | + rmultiDash = /([A-Z])/g; |
1409 | 1419 | |
1410 | 1420 | jQuery.extend({ |
1411 | 1421 | cache: {}, |
— | — | @@ -1436,7 +1446,9 @@ |
1437 | 1447 | return; |
1438 | 1448 | } |
1439 | 1449 | |
1440 | | - var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache, |
| 1450 | + var thisCache, ret, |
| 1451 | + internalKey = jQuery.expando, |
| 1452 | + getByName = typeof name === "string", |
1441 | 1453 | |
1442 | 1454 | // We have to handle DOM nodes and JS objects differently because IE6-7 |
1443 | 1455 | // can't GC object references properly across the DOM-JS boundary |
— | — | @@ -1452,7 +1464,7 @@ |
1453 | 1465 | |
1454 | 1466 | // Avoid doing any more work than we need to when trying to get data on an |
1455 | 1467 | // object that has no data at all |
1456 | | - if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) { |
| 1468 | + if ( (!id || (pvt && id && (cache[ id ] && !cache[ id ][ internalKey ]))) && getByName && data === undefined ) { |
1457 | 1469 | return; |
1458 | 1470 | } |
1459 | 1471 | |
— | — | @@ -1511,10 +1523,24 @@ |
1512 | 1524 | return thisCache[ internalKey ] && thisCache[ internalKey ].events; |
1513 | 1525 | } |
1514 | 1526 | |
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; |
| 1527 | + // Check for both converted-to-camel and non-converted data property names |
| 1528 | + // If a data property was specified |
| 1529 | + if ( getByName ) { |
| 1530 | + |
| 1531 | + // First Try to find as-is property data |
| 1532 | + ret = thisCache[ name ]; |
| 1533 | + |
| 1534 | + // Test for null|undefined property data |
| 1535 | + if ( ret == null ) { |
| 1536 | + |
| 1537 | + // Try to find the camelCased property |
| 1538 | + ret = thisCache[ jQuery.camelCase( name ) ]; |
| 1539 | + } |
| 1540 | + } else { |
| 1541 | + ret = thisCache; |
| 1542 | + } |
| 1543 | + |
| 1544 | + return ret; |
1519 | 1545 | }, |
1520 | 1546 | |
1521 | 1547 | removeData: function( elem, name, pvt /* Internal Use Only */ ) { |
— | — | @@ -1522,8 +1548,13 @@ |
1523 | 1549 | return; |
1524 | 1550 | } |
1525 | 1551 | |
1526 | | - var internalKey = jQuery.expando, isNode = elem.nodeType, |
| 1552 | + var thisCache, |
1527 | 1553 | |
| 1554 | + // Reference to internal data cache key |
| 1555 | + internalKey = jQuery.expando, |
| 1556 | + |
| 1557 | + isNode = elem.nodeType, |
| 1558 | + |
1528 | 1559 | // See jQuery.data for more information |
1529 | 1560 | cache = isNode ? jQuery.cache : elem, |
1530 | 1561 | |
— | — | @@ -1537,9 +1568,16 @@ |
1538 | 1569 | } |
1539 | 1570 | |
1540 | 1571 | if ( name ) { |
1541 | | - var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ]; |
1542 | 1572 | |
| 1573 | + thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ]; |
| 1574 | + |
1543 | 1575 | if ( thisCache ) { |
| 1576 | + |
| 1577 | + // Support interoperable removal of hyphenated or camelcased keys |
| 1578 | + if ( !thisCache[ name ] ) { |
| 1579 | + name = jQuery.camelCase( name ); |
| 1580 | + } |
| 1581 | + |
1544 | 1582 | delete thisCache[ name ]; |
1545 | 1583 | |
1546 | 1584 | // If there is no data left in the cache, we want to continue |
— | — | @@ -1566,7 +1604,8 @@ |
1567 | 1605 | // Browsers that fail expando deletion also refuse to delete expandos on |
1568 | 1606 | // the window, but it will allow it on all other JS objects; other browsers |
1569 | 1607 | // don't care |
1570 | | - if ( jQuery.support.deleteExpando || cache != window ) { |
| 1608 | + // Ensure that `cache` is not a window object #10080 |
| 1609 | + if ( jQuery.support.deleteExpando || !cache.setInterval ) { |
1571 | 1610 | delete cache[ id ]; |
1572 | 1611 | } else { |
1573 | 1612 | cache[ id ] = null; |
— | — | @@ -1690,8 +1729,9 @@ |
1691 | 1730 | // If nothing was found internally, try to fetch any |
1692 | 1731 | // data from the HTML5 data-* attribute |
1693 | 1732 | if ( data === undefined && elem.nodeType === 1 ) { |
1694 | | - var name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase(); |
1695 | 1733 | |
| 1734 | + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); |
| 1735 | + |
1696 | 1736 | data = elem.getAttribute( name ); |
1697 | 1737 | |
1698 | 1738 | if ( typeof data === "string" ) { |
— | — | @@ -1910,8 +1950,7 @@ |
1911 | 1951 | rfocusable = /^(?:button|input|object|select|textarea)$/i, |
1912 | 1952 | rclickable = /^a(?:rea)?$/i, |
1913 | 1953 | rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, |
1914 | | - rinvalidChar = /\:|^on/, |
1915 | | - formHook, boolHook; |
| 1954 | + nodeHook, boolHook; |
1916 | 1955 | |
1917 | 1956 | jQuery.fn.extend({ |
1918 | 1957 | attr: function( name, value ) { |
— | — | @@ -2049,7 +2088,7 @@ |
2050 | 2089 | hasClass: function( selector ) { |
2051 | 2090 | var className = " " + selector + " "; |
2052 | 2091 | for ( var i = 0, l = this.length; i < l; i++ ) { |
2053 | | - if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { |
| 2092 | + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { |
2054 | 2093 | return true; |
2055 | 2094 | } |
2056 | 2095 | } |
— | — | @@ -2229,14 +2268,11 @@ |
2230 | 2269 | if ( !hooks ) { |
2231 | 2270 | // Use boolHook for boolean attributes |
2232 | 2271 | if ( rboolean.test( name ) ) { |
2233 | | - |
2234 | 2272 | hooks = boolHook; |
2235 | 2273 | |
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; |
| 2274 | + // Use nodeHook if available( IE6/7 ) |
| 2275 | + } else if ( nodeHook ) { |
| 2276 | + hooks = nodeHook; |
2241 | 2277 | } |
2242 | 2278 | } |
2243 | 2279 | } |
— | — | @@ -2273,15 +2309,10 @@ |
2274 | 2310 | var propName; |
2275 | 2311 | if ( elem.nodeType === 1 ) { |
2276 | 2312 | name = jQuery.attrFix[ name ] || name; |
2277 | | - |
2278 | | - if ( jQuery.support.getSetAttribute ) { |
2279 | | - // Use removeAttribute in browsers that support it |
2280 | | - elem.removeAttribute( name ); |
2281 | | - } else { |
2282 | | - jQuery.attr( elem, name, "" ); |
2283 | | - elem.removeAttributeNode( elem.getAttributeNode( name ) ); |
2284 | | - } |
2285 | 2313 | |
| 2314 | + jQuery.attr( elem, name, "" ); |
| 2315 | + elem.removeAttribute( name ); |
| 2316 | + |
2286 | 2317 | // Set corresponding property to false for boolean attributes |
2287 | 2318 | if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) { |
2288 | 2319 | elem[ propName ] = false; |
— | — | @@ -2308,33 +2339,20 @@ |
2309 | 2340 | } |
2310 | 2341 | } |
2311 | 2342 | }, |
2312 | | - tabIndex: { |
2313 | | - get: function( elem ) { |
2314 | | - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set |
2315 | | - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
2316 | | - var attributeNode = elem.getAttributeNode("tabIndex"); |
2317 | | - |
2318 | | - return attributeNode && attributeNode.specified ? |
2319 | | - parseInt( attributeNode.value, 10 ) : |
2320 | | - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? |
2321 | | - 0 : |
2322 | | - undefined; |
2323 | | - } |
2324 | | - }, |
2325 | 2343 | // Use the value property for back compat |
2326 | | - // Use the formHook for button elements in IE6/7 (#1954) |
| 2344 | + // Use the nodeHook for button elements in IE6/7 (#1954) |
2327 | 2345 | value: { |
2328 | 2346 | get: function( elem, name ) { |
2329 | | - if ( formHook && jQuery.nodeName( elem, "button" ) ) { |
2330 | | - return formHook.get( elem, name ); |
| 2347 | + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { |
| 2348 | + return nodeHook.get( elem, name ); |
2331 | 2349 | } |
2332 | 2350 | return name in elem ? |
2333 | 2351 | elem.value : |
2334 | 2352 | null; |
2335 | 2353 | }, |
2336 | 2354 | set: function( elem, value, name ) { |
2337 | | - if ( formHook && jQuery.nodeName( elem, "button" ) ) { |
2338 | | - return formHook.set( elem, value, name ); |
| 2355 | + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { |
| 2356 | + return nodeHook.set( elem, value, name ); |
2339 | 2357 | } |
2340 | 2358 | // Does not return so that setAttribute is also used |
2341 | 2359 | elem.value = value; |
— | — | @@ -2383,7 +2401,7 @@ |
2384 | 2402 | } |
2385 | 2403 | |
2386 | 2404 | } else { |
2387 | | - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) { |
| 2405 | + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { |
2388 | 2406 | return ret; |
2389 | 2407 | |
2390 | 2408 | } else { |
— | — | @@ -2392,14 +2410,33 @@ |
2393 | 2411 | } |
2394 | 2412 | }, |
2395 | 2413 | |
2396 | | - propHooks: {} |
| 2414 | + propHooks: { |
| 2415 | + tabIndex: { |
| 2416 | + get: function( elem ) { |
| 2417 | + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set |
| 2418 | + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
| 2419 | + var attributeNode = elem.getAttributeNode("tabindex"); |
| 2420 | + |
| 2421 | + return attributeNode && attributeNode.specified ? |
| 2422 | + parseInt( attributeNode.value, 10 ) : |
| 2423 | + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? |
| 2424 | + 0 : |
| 2425 | + undefined; |
| 2426 | + } |
| 2427 | + } |
| 2428 | + } |
2397 | 2429 | }); |
2398 | 2430 | |
| 2431 | +// Add the tabindex propHook to attrHooks for back-compat |
| 2432 | +jQuery.attrHooks.tabIndex = jQuery.propHooks.tabIndex; |
| 2433 | + |
2399 | 2434 | // Hook for boolean attributes |
2400 | 2435 | boolHook = { |
2401 | 2436 | get: function( elem, name ) { |
2402 | 2437 | // Align boolean attributes with corresponding properties |
2403 | | - return jQuery.prop( elem, name ) ? |
| 2438 | + // Fall back to attribute presence where some booleans are not supported |
| 2439 | + var attrNode; |
| 2440 | + return jQuery.prop( elem, name ) === true || ( attrNode = elem.getAttributeNode( name ) ) && attrNode.nodeValue !== false ? |
2404 | 2441 | name.toLowerCase() : |
2405 | 2442 | undefined; |
2406 | 2443 | }, |
— | — | @@ -2425,12 +2462,10 @@ |
2426 | 2463 | |
2427 | 2464 | // IE6/7 do not support getting/setting some attributes with get/setAttribute |
2428 | 2465 | if ( !jQuery.support.getSetAttribute ) { |
2429 | | - |
2430 | | - // propFix is more comprehensive and contains all fixes |
2431 | | - jQuery.attrFix = jQuery.propFix; |
2432 | 2466 | |
2433 | | - // Use this for any attribute on a form in IE6/7 |
2434 | | - formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = { |
| 2467 | + // Use this for any attribute in IE6/7 |
| 2468 | + // This fixes almost every IE6/7 issue |
| 2469 | + nodeHook = jQuery.valHooks.button = { |
2435 | 2470 | get: function( elem, name ) { |
2436 | 2471 | var ret; |
2437 | 2472 | ret = elem.getAttributeNode( name ); |
— | — | @@ -2440,13 +2475,13 @@ |
2441 | 2476 | undefined; |
2442 | 2477 | }, |
2443 | 2478 | set: function( elem, value, name ) { |
2444 | | - // Check form objects in IE (multiple bugs related) |
2445 | | - // Only use nodeValue if the attribute node exists on the form |
| 2479 | + // Set the existing or create a new attribute node |
2446 | 2480 | var ret = elem.getAttributeNode( name ); |
2447 | | - if ( ret ) { |
2448 | | - ret.nodeValue = value; |
2449 | | - return value; |
| 2481 | + if ( !ret ) { |
| 2482 | + ret = document.createAttribute( name ); |
| 2483 | + elem.setAttributeNode( ret ); |
2450 | 2484 | } |
| 2485 | + return (ret.nodeValue = value + ""); |
2451 | 2486 | } |
2452 | 2487 | }; |
2453 | 2488 | |
— | — | @@ -2505,6 +2540,7 @@ |
2506 | 2541 | parent.parentNode.selectedIndex; |
2507 | 2542 | } |
2508 | 2543 | } |
| 2544 | + return null; |
2509 | 2545 | } |
2510 | 2546 | }); |
2511 | 2547 | } |
— | — | @@ -3235,8 +3271,9 @@ |
3236 | 3272 | setup: function( data, namespaces ) { |
3237 | 3273 | if ( !jQuery.nodeName( this, "form" ) ) { |
3238 | 3274 | jQuery.event.add(this, "click.specialSubmit", function( e ) { |
| 3275 | + // Avoid triggering error on non-existent type attribute in IE VML (#7071) |
3239 | 3276 | var elem = e.target, |
3240 | | - type = elem.type; |
| 3277 | + type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : ""; |
3241 | 3278 | |
3242 | 3279 | if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { |
3243 | 3280 | trigger( "submit", this, arguments ); |
— | — | @@ -3245,7 +3282,7 @@ |
3246 | 3283 | |
3247 | 3284 | jQuery.event.add(this, "keypress.specialSubmit", function( e ) { |
3248 | 3285 | var elem = e.target, |
3249 | | - type = elem.type; |
| 3286 | + type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : ""; |
3250 | 3287 | |
3251 | 3288 | if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { |
3252 | 3289 | trigger( "submit", this, arguments ); |
— | — | @@ -3270,7 +3307,8 @@ |
3271 | 3308 | var changeFilters, |
3272 | 3309 | |
3273 | 3310 | getVal = function( elem ) { |
3274 | | - var type = elem.type, val = elem.value; |
| 3311 | + var type = jQuery.nodeName( elem, "input" ) ? elem.type : "", |
| 3312 | + val = elem.value; |
3275 | 3313 | |
3276 | 3314 | if ( type === "radio" || type === "checkbox" ) { |
3277 | 3315 | val = elem.checked; |
— | — | @@ -5295,12 +5333,17 @@ |
5296 | 5334 | // Determine the position of an element within |
5297 | 5335 | // the matched set of elements |
5298 | 5336 | index: function( elem ) { |
5299 | | - if ( !elem || typeof elem === "string" ) { |
5300 | | - return jQuery.inArray( this[0], |
5301 | | - // If it receives a string, the selector is used |
5302 | | - // If it receives nothing, the siblings are used |
5303 | | - elem ? jQuery( elem ) : this.parent().children() ); |
| 5337 | + |
| 5338 | + // No argument, return index in parent |
| 5339 | + if ( !elem ) { |
| 5340 | + return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; |
5304 | 5341 | } |
| 5342 | + |
| 5343 | + // index in selector |
| 5344 | + if ( typeof elem === "string" ) { |
| 5345 | + return jQuery.inArray( this[0], jQuery( elem ) ); |
| 5346 | + } |
| 5347 | + |
5305 | 5348 | // Locate the position of the desired element |
5306 | 5349 | return jQuery.inArray( |
5307 | 5350 | // If it receives a jQuery object, the first element is used |
— | — | @@ -6048,7 +6091,10 @@ |
6049 | 6092 | // with an element if you are cloning the body and one of the |
6050 | 6093 | // elements on the page has a name or id of "length" |
6051 | 6094 | for ( i = 0; srcElements[i]; ++i ) { |
6052 | | - cloneFixAttributes( srcElements[i], destElements[i] ); |
| 6095 | + // Ensure that the destination node is not null; Fixes #9587 |
| 6096 | + if ( destElements[i] ) { |
| 6097 | + cloneFixAttributes( srcElements[i], destElements[i] ); |
| 6098 | + } |
6053 | 6099 | } |
6054 | 6100 | } |
6055 | 6101 | |
— | — | @@ -6248,14 +6294,14 @@ |
6249 | 6295 | |
6250 | 6296 | |
6251 | 6297 | |
| 6298 | + |
6252 | 6299 | var ralpha = /alpha\([^)]*\)/i, |
6253 | 6300 | ropacity = /opacity=([^)]*)/, |
6254 | 6301 | // fixed for IE9, see #8346 |
6255 | 6302 | rupper = /([A-Z]|^ms)/g, |
6256 | 6303 | rnumpx = /^-?\d+(?:px)?$/i, |
6257 | 6304 | rnum = /^-?\d/, |
6258 | | - rrelNum = /^[+\-]=/, |
6259 | | - rrelNumFilter = /[^+\-\.\de]+/g, |
| 6305 | + rrelNum = /^([\-+])=([\-+.\de]+)/, |
6260 | 6306 | |
6261 | 6307 | cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
6262 | 6308 | cssWidth = [ "Left", "Right" ], |
— | — | @@ -6332,18 +6378,18 @@ |
6333 | 6379 | if ( value !== undefined ) { |
6334 | 6380 | type = typeof value; |
6335 | 6381 | |
6336 | | - // Make sure that NaN and null values aren't set. See: #7116 |
6337 | | - if ( type === "number" && isNaN( value ) || value == null ) { |
6338 | | - return; |
6339 | | - } |
6340 | | - |
6341 | 6382 | // convert relative number strings (+= or -=) to relative numbers. #7345 |
6342 | | - if ( type === "string" && rrelNum.test( value ) ) { |
6343 | | - value = +value.replace( rrelNumFilter, "" ) + parseFloat( jQuery.css( elem, name ) ); |
| 6383 | + if ( type === "string" && (ret = rrelNum.exec( value )) ) { |
| 6384 | + value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) ); |
6344 | 6385 | // Fixes bug #9237 |
6345 | 6386 | type = "number"; |
6346 | 6387 | } |
6347 | 6388 | |
| 6389 | + // Make sure that NaN and null values aren't set. See: #7116 |
| 6390 | + if ( value == null || type === "number" && isNaN( value ) ) { |
| 6391 | + return; |
| 6392 | + } |
| 6393 | + |
6348 | 6394 | // If a number was passed in, add 'px' to the (except for certain CSS properties) |
6349 | 6395 | if ( type === "number" && !jQuery.cssNumber[ origName ] ) { |
6350 | 6396 | value += "px"; |
— | — | @@ -6459,18 +6505,29 @@ |
6460 | 6506 | |
6461 | 6507 | set: function( elem, value ) { |
6462 | 6508 | var style = elem.style, |
6463 | | - currentStyle = elem.currentStyle; |
| 6509 | + currentStyle = elem.currentStyle, |
| 6510 | + opacity = jQuery.isNaN( value ) ? "" : "alpha(opacity=" + value * 100 + ")", |
| 6511 | + filter = currentStyle && currentStyle.filter || style.filter || ""; |
6464 | 6512 | |
6465 | 6513 | // IE has trouble with opacity if it does not have layout |
6466 | 6514 | // Force it by setting the zoom level |
6467 | 6515 | style.zoom = 1; |
6468 | 6516 | |
6469 | | - // Set the alpha filter to set the opacity |
6470 | | - var opacity = jQuery.isNaN( value ) ? |
6471 | | - "" : |
6472 | | - "alpha(opacity=" + value * 100 + ")", |
6473 | | - filter = currentStyle && currentStyle.filter || style.filter || ""; |
| 6517 | + // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 |
| 6518 | + if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) { |
6474 | 6519 | |
| 6520 | + // Setting style.filter to null, "" & " " still leave "filter:" in the cssText |
| 6521 | + // if "filter:" is present at all, clearType is disabled, we want to avoid this |
| 6522 | + // style.removeAttribute is IE Only, but so apparently is this code path... |
| 6523 | + style.removeAttribute( "filter" ); |
| 6524 | + |
| 6525 | + // if there there is no filter style applied in a css rule, we are done |
| 6526 | + if ( currentStyle && !currentStyle.filter ) { |
| 6527 | + return; |
| 6528 | + } |
| 6529 | + } |
| 6530 | + |
| 6531 | + // otherwise, set new filter values |
6475 | 6532 | style.filter = ralpha.test( filter ) ? |
6476 | 6533 | filter.replace( ralpha, opacity ) : |
6477 | 6534 | filter + " " + opacity; |
— | — | @@ -6625,9 +6682,9 @@ |
6626 | 6683 | rCRLF = /\r?\n/g, |
6627 | 6684 | rhash = /#.*$/, |
6628 | 6685 | rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL |
6629 | | - rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, |
| 6686 | + rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, |
6630 | 6687 | // #7653, #8125, #8152: local protocol detection |
6631 | | - rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/, |
| 6688 | + rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, |
6632 | 6689 | rnoContent = /^(?:GET|HEAD)$/, |
6633 | 6690 | rprotocol = /^\/\//, |
6634 | 6691 | rquery = /\?/, |
— | — | @@ -6662,7 +6719,10 @@ |
6663 | 6720 | ajaxLocation, |
6664 | 6721 | |
6665 | 6722 | // Document location segments |
6666 | | - ajaxLocParts; |
| 6723 | + ajaxLocParts, |
| 6724 | + |
| 6725 | + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression |
| 6726 | + allTypes = ["*/"] + ["*"]; |
6667 | 6727 | |
6668 | 6728 | // #8138, IE may throw an exception when accessing |
6669 | 6729 | // a field from window.location if document.domain has been set |
— | — | @@ -6755,6 +6815,22 @@ |
6756 | 6816 | return selection; |
6757 | 6817 | } |
6758 | 6818 | |
| 6819 | +// A special extend for ajax options |
| 6820 | +// that takes "flat" options (not to be deep extended) |
| 6821 | +// Fixes #9887 |
| 6822 | +function ajaxExtend( target, src ) { |
| 6823 | + var key, deep, |
| 6824 | + flatOptions = jQuery.ajaxSettings.flatOptions || {}; |
| 6825 | + for( key in src ) { |
| 6826 | + if ( src[ key ] !== undefined ) { |
| 6827 | + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; |
| 6828 | + } |
| 6829 | + } |
| 6830 | + if ( deep ) { |
| 6831 | + jQuery.extend( true, target, deep ); |
| 6832 | + } |
| 6833 | +} |
| 6834 | + |
6759 | 6835 | jQuery.fn.extend({ |
6760 | 6836 | load: function( url, params, callback ) { |
6761 | 6837 | if ( typeof url !== "string" && _load ) { |
— | — | @@ -6898,23 +6974,16 @@ |
6899 | 6975 | // Creates a full fledged settings object into target |
6900 | 6976 | // with both ajaxSettings and settings fields. |
6901 | 6977 | // If target is omitted, writes into ajaxSettings. |
6902 | | - ajaxSetup: function ( target, settings ) { |
6903 | | - if ( !settings ) { |
6904 | | - // Only one parameter, we extend ajaxSettings |
| 6978 | + ajaxSetup: function( target, settings ) { |
| 6979 | + if ( settings ) { |
| 6980 | + // Building a settings object |
| 6981 | + ajaxExtend( target, jQuery.ajaxSettings ); |
| 6982 | + } else { |
| 6983 | + // Extending ajaxSettings |
6905 | 6984 | settings = target; |
6906 | | - target = jQuery.extend( true, jQuery.ajaxSettings, settings ); |
6907 | | - } else { |
6908 | | - // target was provided, we extend into it |
6909 | | - jQuery.extend( true, target, jQuery.ajaxSettings, settings ); |
| 6985 | + target = jQuery.ajaxSettings; |
6910 | 6986 | } |
6911 | | - // Flatten fields we don't want deep extended |
6912 | | - for( var field in { context: 1, url: 1 } ) { |
6913 | | - if ( field in settings ) { |
6914 | | - target[ field ] = settings[ field ]; |
6915 | | - } else if( field in jQuery.ajaxSettings ) { |
6916 | | - target[ field ] = jQuery.ajaxSettings[ field ]; |
6917 | | - } |
6918 | | - } |
| 6987 | + ajaxExtend( target, settings ); |
6919 | 6988 | return target; |
6920 | 6989 | }, |
6921 | 6990 | |
— | — | @@ -6942,7 +7011,7 @@ |
6943 | 7012 | html: "text/html", |
6944 | 7013 | text: "text/plain", |
6945 | 7014 | json: "application/json, text/javascript", |
6946 | | - "*": "*/*" |
| 7015 | + "*": allTypes |
6947 | 7016 | }, |
6948 | 7017 | |
6949 | 7018 | contents: { |
— | — | @@ -6972,6 +7041,15 @@ |
6973 | 7042 | |
6974 | 7043 | // Parse text as xml |
6975 | 7044 | "text xml": jQuery.parseXML |
| 7045 | + }, |
| 7046 | + |
| 7047 | + // For options that shouldn't be deep extended: |
| 7048 | + // you can add your own custom options here if |
| 7049 | + // and when you create one that shouldn't be |
| 7050 | + // deep extended (see ajaxExtend) |
| 7051 | + flatOptions: { |
| 7052 | + context: true, |
| 7053 | + url: true |
6976 | 7054 | } |
6977 | 7055 | }, |
6978 | 7056 | |
— | — | @@ -7082,7 +7160,7 @@ |
7083 | 7161 | // Callback for when everything is done |
7084 | 7162 | // It is defined here because jslint complains if it is declared |
7085 | 7163 | // at the end of the function (which would be more logical and readable) |
7086 | | - function done( status, statusText, responses, headers ) { |
| 7164 | + function done( status, nativeStatusText, responses, headers ) { |
7087 | 7165 | |
7088 | 7166 | // Called once |
7089 | 7167 | if ( state === 2 ) { |
— | — | @@ -7105,11 +7183,12 @@ |
7106 | 7184 | responseHeadersString = headers || ""; |
7107 | 7185 | |
7108 | 7186 | // Set readyState |
7109 | | - jqXHR.readyState = status ? 4 : 0; |
| 7187 | + jqXHR.readyState = status > 0 ? 4 : 0; |
7110 | 7188 | |
7111 | 7189 | var isSuccess, |
7112 | 7190 | success, |
7113 | 7191 | error, |
| 7192 | + statusText = nativeStatusText, |
7114 | 7193 | response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined, |
7115 | 7194 | lastModified, |
7116 | 7195 | etag; |
— | — | @@ -7161,7 +7240,7 @@ |
7162 | 7241 | |
7163 | 7242 | // Set data for the fake xhr object |
7164 | 7243 | jqXHR.status = status; |
7165 | | - jqXHR.statusText = statusText; |
| 7244 | + jqXHR.statusText = "" + ( nativeStatusText || statusText ); |
7166 | 7245 | |
7167 | 7246 | // Success/Error |
7168 | 7247 | if ( isSuccess ) { |
— | — | @@ -7183,7 +7262,7 @@ |
7184 | 7263 | completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] ); |
7185 | 7264 | |
7186 | 7265 | if ( fireGlobals ) { |
7187 | | - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s] ); |
| 7266 | + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); |
7188 | 7267 | // Handle the global AJAX counter |
7189 | 7268 | if ( !( --jQuery.active ) ) { |
7190 | 7269 | jQuery.event.trigger( "ajaxStop" ); |
— | — | @@ -7264,6 +7343,8 @@ |
7265 | 7344 | // If data is available, append data to url |
7266 | 7345 | if ( s.data ) { |
7267 | 7346 | s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; |
| 7347 | + // #9682: remove data so that it's not used in an eventual retry |
| 7348 | + delete s.data; |
7268 | 7349 | } |
7269 | 7350 | |
7270 | 7351 | // Get ifModifiedKey before adding the anti-cache parameter |
— | — | @@ -7301,7 +7382,7 @@ |
7302 | 7383 | jqXHR.setRequestHeader( |
7303 | 7384 | "Accept", |
7304 | 7385 | s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? |
7305 | | - s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) : |
| 7386 | + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : |
7306 | 7387 | s.accepts[ "*" ] |
7307 | 7388 | ); |
7308 | 7389 | |
— | — | @@ -7347,7 +7428,7 @@ |
7348 | 7429 | transport.send( requestHeaders, done ); |
7349 | 7430 | } catch (e) { |
7350 | 7431 | // Propagate exception as error if not done |
7351 | | - if ( status < 2 ) { |
| 7432 | + if ( state < 2 ) { |
7352 | 7433 | done( -1, e ); |
7353 | 7434 | // Simply rethrow otherwise |
7354 | 7435 | } else { |
— | — | @@ -7995,10 +8076,7 @@ |
7996 | 8077 | // opacity animations |
7997 | 8078 | [ "opacity" ] |
7998 | 8079 | ], |
7999 | | - fxNow, |
8000 | | - requestAnimationFrame = window.webkitRequestAnimationFrame || |
8001 | | - window.mozRequestAnimationFrame || |
8002 | | - window.oRequestAnimationFrame; |
| 8080 | + fxNow; |
8003 | 8081 | |
8004 | 8082 | jQuery.fn.extend({ |
8005 | 8083 | show: function( speed, easing, callback ) { |
— | — | @@ -8374,8 +8452,7 @@ |
8375 | 8453 | // Start an animation from one number to another |
8376 | 8454 | custom: function( from, to, unit ) { |
8377 | 8455 | var self = this, |
8378 | | - fx = jQuery.fx, |
8379 | | - raf; |
| 8456 | + fx = jQuery.fx; |
8380 | 8457 | |
8381 | 8458 | this.startTime = fxNow || createFxNow(); |
8382 | 8459 | this.start = from; |
— | — | @@ -8391,20 +8468,7 @@ |
8392 | 8469 | t.elem = this.elem; |
8393 | 8470 | |
8394 | 8471 | if ( t() && jQuery.timers.push(t) && !timerId ) { |
8395 | | - // Use requestAnimationFrame instead of setInterval if available |
8396 | | - if ( requestAnimationFrame ) { |
8397 | | - timerId = true; |
8398 | | - raf = function() { |
8399 | | - // When timerId gets set to null at any point, this stops |
8400 | | - if ( timerId ) { |
8401 | | - requestAnimationFrame( raf ); |
8402 | | - fx.tick(); |
8403 | | - } |
8404 | | - }; |
8405 | | - requestAnimationFrame( raf ); |
8406 | | - } else { |
8407 | | - timerId = setInterval( fx.tick, fx.interval ); |
8408 | | - } |
| 8472 | + timerId = setInterval( fx.tick, fx.interval ); |
8409 | 8473 | } |
8410 | 8474 | }, |
8411 | 8475 | |
— | — | @@ -8947,9 +9011,10 @@ |
8948 | 9012 | if ( jQuery.isWindow( elem ) ) { |
8949 | 9013 | // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode |
8950 | 9014 | // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat |
8951 | | - var docElemProp = elem.document.documentElement[ "client" + name ]; |
| 9015 | + var docElemProp = elem.document.documentElement[ "client" + name ], |
| 9016 | + body = elem.document.body; |
8952 | 9017 | return elem.document.compatMode === "CSS1Compat" && docElemProp || |
8953 | | - elem.document.body[ "client" + name ] || docElemProp; |
| 9018 | + body && body[ "client" + name ] || docElemProp; |
8954 | 9019 | |
8955 | 9020 | // Get document width or height |
8956 | 9021 | } else if ( elem.nodeType === 9 ) { |
— | — | @@ -8978,4 +9043,4 @@ |
8979 | 9044 | |
8980 | 9045 | // Expose jQuery to the global object |
8981 | 9046 | window.jQuery = window.$ = jQuery; |
8982 | | -})(window); |
\ No newline at end of file |
| 9047 | +})(window); |