WordPress.org

Make WordPress Core

Ticket #22975: 22975.migrate.1.2.1.patch

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

     
    11/*!
    2  * jQuery Migrate - v1.1.1 - 2013-02-16
     2 * jQuery Migrate - v1.2.1 - 2013-05-08
    33 * https://github.com/jquery/jquery-migrate
    44 * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
    55 */
     
    1717// jQuery.migrateMute = false;
    1818
    1919// Show a message on the console so devs know we're active
    20 if ( !jQuery.migrateMute && window.console && console.log ) {
    21         console.log("JQMIGRATE: Logging is active");
     20if ( !jQuery.migrateMute && window.console && window.console.log ) {
     21        window.console.log("JQMIGRATE: Logging is active");
    2222}
    2323
    2424// Set to false to disable traces that appear with warnings
     
    3333};
    3434
    3535function migrateWarn( msg) {
     36        var console = window.console;
    3637        if ( !warnedAbout[ msg ] ) {
    3738                warnedAbout[ msg ] = true;
    3839                jQuery.migrateWarnings.push( msg );
    39                 if ( window.console && console.warn && !jQuery.migrateMute ) {
     40                if ( console && console.warn && !jQuery.migrateMute ) {
    4041                        console.warn( "JQMIGRATE: " + msg );
    4142                        if ( jQuery.migrateTrace && console.trace ) {
    4243                                console.trace();
     
    189190var matched, browser,
    190191        oldInit = jQuery.fn.init,
    191192        oldParseJSON = jQuery.parseJSON,
    192         // Note this does NOT include the #9521 XSS fix from 1.7!
    193         rquickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*|#([\w\-]*))$/;
     193        // Note: XSS check is done below after string is trimmed
     194        rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
    194195
    195196// $(html) "looks like html" rule change
    196197jQuery.fn.init = function( selector, context, rootjQuery ) {
    197198        var match;
    198199
    199200        if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
    200                         (match = rquickExpr.exec( selector )) && match[1] ) {
     201                        (match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
    201202                // This is an HTML string according to the "old" rules; is it still?
    202203                if ( selector.charAt( 0 ) !== "<" ) {
    203204                        migrateWarn("$(html) HTML strings must start with '<' character");
    204205                }
     206                if ( match[ 3 ] ) {
     207                        migrateWarn("$(html) HTML text after last tag is ignored");
     208                }
     209                // Consistently reject any HTML-like string starting with a hash (#9521)
     210                // Note that this may break jQuery 1.6.x code that otherwise would work.
     211                if ( match[ 0 ].charAt( 0 ) === "#" ) {
     212                        migrateWarn("HTML string cannot start with a '#' character");
     213                        jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
     214                }
    205215                // Now process using loose rules; let pre-1.8 play too
    206216                if ( context && context.context ) {
    207217                        // jQuery object as context; parseHTML expects a DOM object
    208218                        context = context.context;
    209219                }
    210220                if ( jQuery.parseHTML ) {
    211                         return oldInit.call( this, jQuery.parseHTML( jQuery.trim(selector), context, true ),
     221                        return oldInit.call( this, jQuery.parseHTML( match[ 2 ], context, true ),
    212222                                        context, rootjQuery );
    213223                }
    214224        }
  • wp-includes/script-loader.php

     
    134134        // jQuery
    135135        $scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ) );
    136136        $scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.9.1' );
    137         $scripts->add( 'jquery-migrate', '/wp-includes/js/jquery/jquery-migrate.js', array(), '1.1.1' );
     137        $scripts->add( 'jquery-migrate', '/wp-includes/js/jquery/jquery-migrate.js', array(), '1.2.1' );
    138138
    139139        // full jQuery UI
    140140        $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui/jquery.ui.core.min.js', array('jquery'), '1.10.3', 1 );