WordPress.org

Make WordPress Core

Changeset 23516


Ignore:
Timestamp:
02/28/2013 06:02:26 PM (5 years ago)
Author:
nacin
Message:

jQuery Migrate 1.1.1. props ocean90. see #22975.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/jquery/jquery-migrate.js

    r23421 r23516  
    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
     
    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 ||
     
    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 ) {
     
    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        }
     
    238242};
    239243
    240 matched = jQuery.uaMatch( navigator.userAgent );
    241 browser = {};
    242 
    243 if ( matched.browser ) {
    244     browser[ matched.browser ] = true;
    245     browser.version = matched.version;
    246 }
    247 
    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;
    253 }
    254 
    255 jQuery.browser = 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 = {};
     248
     249    if ( matched.browser ) {
     250        browser[ matched.browser ] = true;
     251        browser.version = matched.version;
     252    }
     253
     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;
     262}
    256263
    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() {
     
    279286    return jQuerySub;
    280287};
     288
     289
     290// Ensure that $.ajax gets the new parseJSON defined in core.js
     291jQuery.ajaxSetup({
     292    converters: {
     293        "text json": jQuery.parseJSON
     294    }
     295});
    281296
    282297
     
    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        }
     
    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    }
  • trunk/wp-includes/script-loader.php

    r23507 r23516  
    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
Note: See TracChangeset for help on using the changeset viewer.