WordPress.org

Make WordPress Core

Ticket #22975: jquery.migrate.1.1.1.patch

File jquery.migrate.1.1.1.patch, 5.0 KB (added by ocean90, 5 years ago)
  • wp-includes/js/jquery/jquery-migrate.js

     
    11/*!
    2  * jQuery Migrate - v1.1.0 - 2013-01-31
     2 * jQuery Migrate - v1.1.1 - 2013-02-16
    33 * https://github.com/jquery/jquery-migrate
    44 * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
    55 */
    66(function( jQuery, window, undefined ) {
    7 "use strict";
     7// See http://bugs.jquery.com/ticket/13335
     8// "use strict";
    89
    910
    1011var warnedAbout = {};
     
    7879}
    7980
    8081
    81 var attrFn = {},
     82var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
    8283        oldAttr = jQuery.attr,
    8384        valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
    8485                function() { return null; },
     
    9091        ruseDefault = /^(?:checked|selected)$/i;
    9192
    9293// jQuery.attrFn
    93 migrateWarnProp( jQuery, "attrFn", attrFn, "jQuery.attrFn is deprecated" );
     94migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
    9495
    9596jQuery.attr = function( elem, name, value, pass ) {
    9697        var lowerName = name.toLowerCase(),
    9798                nType = elem && elem.nodeType;
    9899
    99         // Since pass is used internally, we only warn and shim for new jQuery
    100         // versions where there isn't a pass arg in the formal params
    101         if ( pass && oldAttr.length < 4 ) {
    102                 migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
    103                 if ( elem && !rnoAttrNodeType.test( nType ) && jQuery.isFunction( jQuery.fn[ name ] ) ) {
     100        if ( pass ) {
     101                // Since pass is used internally, we only warn for new jQuery
     102                // versions where there isn't a pass arg in the formal params
     103                if ( oldAttr.length < 4 ) {
     104                        migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
     105                }
     106                if ( elem && !rnoAttrNodeType.test( nType ) &&
     107                        (attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
    104108                        return jQuery( elem )[ name ]( value );
    105109                }
    106110        }
     
    237241        };
    238242};
    239243
    240 matched = jQuery.uaMatch( navigator.userAgent );
    241 browser = {};
     244// Don't clobber any existing jQuery.browser in case it's different
     245if ( !jQuery.browser ) {
     246        matched = jQuery.uaMatch( navigator.userAgent );
     247        browser = {};
    242248
    243 if ( matched.browser ) {
    244         browser[ matched.browser ] = true;
    245         browser.version = matched.version;
    246 }
     249        if ( matched.browser ) {
     250                browser[ matched.browser ] = true;
     251                browser.version = matched.version;
     252        }
    247253
    248 // Chrome is Webkit, but Webkit is also Safari.
    249 if ( browser.chrome ) {
    250         browser.webkit = true;
    251 } else if ( browser.webkit ) {
    252         browser.safari = true;
     254        // Chrome is Webkit, but Webkit is also Safari.
     255        if ( browser.chrome ) {
     256                browser.webkit = true;
     257        } else if ( browser.webkit ) {
     258                browser.safari = true;
     259        }
     260
     261        jQuery.browser = browser;
    253262}
    254263
    255 jQuery.browser = browser;
    256 
    257264// Warn if the code tries to get jQuery.browser
    258 migrateWarnProp( jQuery, "browser", browser, "jQuery.browser is deprecated" );
     265migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
    259266
    260267jQuery.sub = function() {
    261268        function jQuerySub( selector, context ) {
     
    280287};
    281288
    282289
     290// Ensure that $.ajax gets the new parseJSON defined in core.js
     291jQuery.ajaxSetup({
     292        converters: {
     293                "text json": jQuery.parseJSON
     294        }
     295});
     296
     297
    283298var oldFnData = jQuery.fn.data;
    284299
    285300jQuery.fn.data = function( name ) {
     
    367382        rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
    368383        rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
    369384        hoverHack = function( events ) {
    370                 if ( typeof( events ) != "string" || jQuery.event.special.hover ) {
     385                if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
    371386                        return events;
    372387                }
    373388                if ( rhoverHack.test( events ) ) {
     
    462477
    463478// Turn global events into document-triggered events
    464479jQuery.event.trigger = function( event, data, elem, onlyHandlers  ){
    465         if ( !elem & !rajaxEvent.test( event ) ) {
     480        if ( !elem && !rajaxEvent.test( event ) ) {
    466481                migrateWarn( "Global events are undocumented and deprecated" );
    467482        }
    468483        return eventTrigger.call( this,  event, data, elem || document, onlyHandlers  );
     
    493508);
    494509
    495510
    496 })( jQuery, window );
    497  No newline at end of file
     511})( jQuery, window );
  • wp-includes/script-loader.php

     
    132132        // jQuery
    133133        $scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ) );
    134134        $scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.9.1' );
    135         $scripts->add( 'jquery-migrate', '/wp-includes/js/jquery/jquery-migrate.js', array(), '1.1.0' );
     135        $scripts->add( 'jquery-migrate', '/wp-includes/js/jquery/jquery-migrate.js', array(), '1.1.1' );
    136136
    137137        // full jQuery UI
    138138        $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui/jquery.ui.core.min.js', array('jquery'), '1.10.1', 1 );