diff --git a/wp-includes/js/jquery/jquery-migrate.js b/wp-includes/js/jquery/jquery-migrate.js index 3185ed1f34..e99f954e63 100644 --- a/wp-includes/js/jquery/jquery-migrate.js +++ b/wp-includes/js/jquery/jquery-migrate.js @@ -1,10 +1,11 @@ /*! - * jQuery Migrate - v1.1.0 - 2013-01-31 + * jQuery Migrate - v1.1.1 - 2013-02-16 * https://github.com/jquery/jquery-migrate * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT */ (function( jQuery, window, undefined ) { -"use strict"; +// See http://bugs.jquery.com/ticket/13335 +// "use strict"; var warnedAbout = {}; @@ -78,7 +79,7 @@ if ( document.compatMode === "BackCompat" ) { } -var attrFn = {}, +var attrFn = jQuery( "", { size: 1 } ).attr("size") && jQuery.attrFn, oldAttr = jQuery.attr, valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get || function() { return null; }, @@ -90,17 +91,20 @@ var attrFn = {}, ruseDefault = /^(?:checked|selected)$/i; // jQuery.attrFn -migrateWarnProp( jQuery, "attrFn", attrFn, "jQuery.attrFn is deprecated" ); +migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" ); jQuery.attr = function( elem, name, value, pass ) { var lowerName = name.toLowerCase(), nType = elem && elem.nodeType; - // Since pass is used internally, we only warn and shim for new jQuery - // versions where there isn't a pass arg in the formal params - if ( pass && oldAttr.length < 4 ) { - migrateWarn("jQuery.fn.attr( props, pass ) is deprecated"); - if ( elem && !rnoAttrNodeType.test( nType ) && jQuery.isFunction( jQuery.fn[ name ] ) ) { + if ( pass ) { + // Since pass is used internally, we only warn for new jQuery + // versions where there isn't a pass arg in the formal params + if ( oldAttr.length < 4 ) { + migrateWarn("jQuery.fn.attr( props, pass ) is deprecated"); + } + if ( elem && !rnoAttrNodeType.test( nType ) && + (attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) { return jQuery( elem )[ name ]( value ); } } @@ -237,25 +241,28 @@ jQuery.uaMatch = function( ua ) { }; }; -matched = jQuery.uaMatch( navigator.userAgent ); -browser = {}; +// Don't clobber any existing jQuery.browser in case it's different +if ( !jQuery.browser ) { + matched = jQuery.uaMatch( navigator.userAgent ); + browser = {}; -if ( matched.browser ) { - browser[ matched.browser ] = true; - browser.version = matched.version; + if ( matched.browser ) { + browser[ matched.browser ] = true; + browser.version = matched.version; + } + + // Chrome is Webkit, but Webkit is also Safari. + if ( browser.chrome ) { + browser.webkit = true; + } else if ( browser.webkit ) { + browser.safari = true; + } + + jQuery.browser = browser; } -// Chrome is Webkit, but Webkit is also Safari. -if ( browser.chrome ) { - browser.webkit = true; -} else if ( browser.webkit ) { - browser.safari = true; -} - -jQuery.browser = browser; - // Warn if the code tries to get jQuery.browser -migrateWarnProp( jQuery, "browser", browser, "jQuery.browser is deprecated" ); +migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" ); jQuery.sub = function() { function jQuerySub( selector, context ) { @@ -280,6 +287,14 @@ jQuery.sub = function() { }; +// Ensure that $.ajax gets the new parseJSON defined in core.js +jQuery.ajaxSetup({ + converters: { + "text json": jQuery.parseJSON + } +}); + + var oldFnData = jQuery.fn.data; jQuery.fn.data = function( name ) { @@ -367,7 +382,7 @@ var eventAdd = jQuery.event.add, rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ), rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, hoverHack = function( events ) { - if ( typeof( events ) != "string" || jQuery.event.special.hover ) { + if ( typeof( events ) !== "string" || jQuery.event.special.hover ) { return events; } if ( rhoverHack.test( events ) ) { @@ -462,7 +477,7 @@ jQuery.fn.die = function( types, fn ) { // Turn global events into document-triggered events jQuery.event.trigger = function( event, data, elem, onlyHandlers ){ - if ( !elem & !rajaxEvent.test( event ) ) { + if ( !elem && !rajaxEvent.test( event ) ) { migrateWarn( "Global events are undocumented and deprecated" ); } return eventTrigger.call( this, event, data, elem || document, onlyHandlers ); @@ -493,4 +508,4 @@ jQuery.each( ajaxEvents.split("|"), ); -})( jQuery, window ); \ No newline at end of file +})( jQuery, window ); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index e25161aa9f..cea6f3afd1 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -132,7 +132,7 @@ function wp_default_scripts( &$scripts ) { // jQuery $scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ) ); $scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.9.1' ); - $scripts->add( 'jquery-migrate', '/wp-includes/js/jquery/jquery-migrate.js', array(), '1.1.0' ); + $scripts->add( 'jquery-migrate', '/wp-includes/js/jquery/jquery-migrate.js', array(), '1.1.1' ); // full jQuery UI $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui/jquery.ui.core.min.js', array('jquery'), '1.10.1', 1 );