Ticket #22975: 22975.patch
File 22975.patch, 7.5 KB (added by , 10 years ago) |
---|
-
wp-includes/js/jquery/jquery-migrate.js
1 1 /*! 2 * jQuery Migrate - v1. 0.0 - 2013-01-142 * jQuery Migrate - v1.1.0 - 2013-01-31 3 3 * https://github.com/jquery/jquery-migrate 4 4 * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT 5 5 */ … … 15 15 // Set to true to prevent console output; migrateWarnings still maintained 16 16 // jQuery.migrateMute = false; 17 17 18 // Show a message on the console so devs know we're active 19 if ( !jQuery.migrateMute && window.console && console.log ) { 20 console.log("JQMIGRATE: Logging is active"); 21 } 22 23 // Set to false to disable traces that appear with warnings 24 if ( jQuery.migrateTrace === undefined ) { 25 jQuery.migrateTrace = true; 26 } 27 18 28 // Forget any warnings we've already given; public 19 29 jQuery.migrateReset = function() { 20 30 warnedAbout = {}; … … 27 37 jQuery.migrateWarnings.push( msg ); 28 38 if ( window.console && console.warn && !jQuery.migrateMute ) { 29 39 console.warn( "JQMIGRATE: " + msg ); 40 if ( jQuery.migrateTrace && console.trace ) { 41 console.trace(); 42 } 30 43 } 31 44 } 32 45 } … … 66 79 67 80 68 81 var attrFn = {}, 69 attr = jQuery.attr,82 oldAttr = jQuery.attr, 70 83 valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get || 71 84 function() { return null; }, 72 85 valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set || … … 83 96 var lowerName = name.toLowerCase(), 84 97 nType = elem && elem.nodeType; 85 98 86 if ( pass ) { 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 ) { 87 102 migrateWarn("jQuery.fn.attr( props, pass ) is deprecated"); 88 103 if ( elem && !rnoAttrNodeType.test( nType ) && jQuery.isFunction( jQuery.fn[ name ] ) ) { 89 104 return jQuery( elem )[ name ]( value ); 90 105 } 91 106 } 92 107 93 // Warn if user tries to set `type` since it breaks on IE 6/7/8 94 if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) ) { 108 // Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking 109 // for disconnected elements we don't warn on $( "<button>", { type: "button" } ). 110 if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) { 95 111 migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8"); 96 112 } 97 113 … … 131 147 132 148 // Warn only for attributes that can remain distinct from their properties post-1.9 133 149 if ( ruseDefault.test( lowerName ) ) { 134 migrateWarn( "jQuery.fn.attr( " + lowerName + ") may use property instead of attribute" );150 migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" ); 135 151 } 136 152 } 137 153 138 return attr.call( jQuery, elem, name, value );154 return oldAttr.call( jQuery, elem, name, value ); 139 155 }; 140 156 141 157 // attrHooks: value … … 146 162 return valueAttrGet.apply( this, arguments ); 147 163 } 148 164 if ( nodeName !== "input" && nodeName !== "option" ) { 149 migrateWarn(" property-based jQuery.fn.attr('value') is deprecated");165 migrateWarn("jQuery.fn.attr('value') no longer gets properties"); 150 166 } 151 167 return name in elem ? 152 168 elem.value : … … 158 174 return valueAttrSet.apply( this, arguments ); 159 175 } 160 176 if ( nodeName !== "input" && nodeName !== "option" ) { 161 migrateWarn(" property-based jQuery.fn.attr('value', val) is deprecated");177 migrateWarn("jQuery.fn.attr('value', val) no longer sets properties"); 162 178 } 163 179 // Does not return so that setAttribute is also used 164 180 elem.value = value; … … 168 184 169 185 var matched, browser, 170 186 oldInit = jQuery.fn.init, 171 // Note this does NOT include the # XSS fix from 1.7! 172 rquickExpr = /^(?:.*(<[\w\W]+>)[^>]*|#([\w\-]*))$/; 187 oldParseJSON = jQuery.parseJSON, 188 // Note this does NOT include the #9521 XSS fix from 1.7! 189 rquickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*|#([\w\-]*))$/; 173 190 174 191 // $(html) "looks like html" rule change 175 192 jQuery.fn.init = function( selector, context, rootjQuery ) { … … 195 212 }; 196 213 jQuery.fn.init.prototype = jQuery.fn; 197 214 215 // Let $.parseJSON(falsy_value) return null 216 jQuery.parseJSON = function( json ) { 217 if ( !json && json !== null ) { 218 migrateWarn("jQuery.parseJSON requires a valid JSON string"); 219 return null; 220 } 221 return oldParseJSON.apply( this, arguments ); 222 }; 223 198 224 jQuery.uaMatch = function( ua ) { 199 225 ua = ua.toLowerCase(); 200 226 … … 274 300 275 301 276 302 var rscriptType = /\/(java|ecma)script/i, 277 oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack, 278 oldFragment = jQuery.buildFragment; 303 oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack; 279 304 280 305 jQuery.fn.andSelf = function() { 281 306 migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"); … … 332 357 }; 333 358 } 334 359 335 jQuery.buildFragment = function( elems, context, scripts, selection ) {336 var ret,337 warning = "jQuery.buildFragment() is deprecated";338 339 // Set context per 1.8 logic340 context = context || document;341 context = !context.nodeType && context[0] || context;342 context = context.ownerDocument || context;343 344 try {345 ret = oldFragment.call( jQuery, elems, context, scripts, selection );346 347 // jQuery < 1.8 required arrayish context; jQuery 1.9 fails on it348 } catch( x ) {349 ret = oldFragment.call( jQuery, elems, context.nodeType ? [ context ] : context[ 0 ], scripts, selection );350 351 // Success from tweaking context means buildFragment was called by the user352 migrateWarn( warning );353 }354 355 // jQuery < 1.9 returned an object instead of the fragment itself356 if ( !ret.fragment ) {357 migrateWarnProp( ret, "fragment", ret, warning );358 migrateWarnProp( ret, "cacheable", false, warning );359 }360 361 return ret;362 };363 364 360 var eventAdd = jQuery.event.add, 365 361 eventRemove = jQuery.event.remove, 366 362 eventTrigger = jQuery.event.trigger, … … 386 382 } 387 383 388 384 // Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7 389 migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" ); 385 if ( jQuery.event.dispatch ) { 386 migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" ); 387 } 390 388 391 389 // Support for 'hover' pseudo-event and ajax event warnings 392 390 jQuery.event.add = function( elem, types, handler, data, selector ){ -
wp-includes/script-loader.php
107 107 ) ); 108 108 109 109 $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), false, 1 ); 110 110 111 111 $scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array('jquery'), false, 1 ); 112 112 did_action( 'init' ) && $scripts->localize( 'heartbeat', 'heartbeatSettings', 113 113 apply_filters( 'heartbeat_settings', array() ) … … 132 132 // jQuery 133 133 $scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ) ); 134 134 $scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.9.0' ); 135 $scripts->add( 'jquery-migrate', '/wp-includes/js/jquery/jquery-migrate.js', array(), '1. 0.0' );135 $scripts->add( 'jquery-migrate', '/wp-includes/js/jquery/jquery-migrate.js', array(), '1.1.0' ); 136 136 137 137 // full jQuery UI 138 138 $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui/jquery.ui.core.min.js', array('jquery'), '1.9.2', 1 );