: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// | /-------------\ | | |- END
// | | / Margin \ | | | Right | | |
// |---------+-| |-+---+-| Bottom |-+----|
// | \ Padding / \ Left / |
// | | / Min \ | / Width \ |
// \--------------+-| |-+---| |---/
rautoPx = /^(?:Border(?:Top|Right|Bottom|Left)?(?:Width|)|(?:Margin|Padding)?(?:Top|Right|Bottom|Left)?|(?:Min|Max)?(?:Width|Height))$/;
// If this version of jQuery has .swap(), don't false-alarm on internal uses
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
jQuery.cssHooks[ name ].get = function() {
ret = oldHook.apply( this, arguments );
internalSwapCall = false;
migratePatchFunc( jQuery, "swap", function( elem, options, callback, args ) {
if ( !internalSwapCall ) {
migrateWarn( "swap", "jQuery.swap() is undocumented and deprecated" );
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
ret = callback.apply( elem, args || [] );
for ( name in options ) {
elem.style[ name ] = old[ name ];
if ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) {
jQuery.cssProps = new Proxy( jQuery.cssProps || {}, {
migrateWarn( "cssProps", "jQuery.cssProps is deprecated" );
return Reflect.set.apply( this, arguments );
// In jQuery >=4 where jQuery.cssNumber is missing fill it with the latest 3.x version:
// https://github.com/jquery/jquery/blob/3.6.0/src/css.js#L212-L233
// This way, number values for the CSS properties below won't start triggering
// Migrate warnings when jQuery gets updated to >=4.0.0 (gh-438).
if ( jQueryVersionSince( "4.0.0" ) ) {
// We need to keep this as a local variable as we need it internally
// in a `jQuery.fn.css` patch and this usage shouldn't warn.
animationIterationCount: true,
if ( typeof Proxy !== "undefined" ) {
jQuery.cssNumber = new Proxy( internalCssNumber, {
migrateWarn( "css-number", "jQuery.cssNumber is deprecated" );
return Reflect.get.apply( this, arguments );
migrateWarn( "css-number", "jQuery.cssNumber is deprecated" );
return Reflect.set.apply( this, arguments );
// IE doesn't support proxies, but we still want to restore the legacy
// jQuery.cssNumber there.
jQuery.cssNumber = internalCssNumber;
// Make `internalCssNumber` defined for jQuery <4 as well as it's needed
// in the `jQuery.fn.css` patch below.
internalCssNumber = jQuery.cssNumber;
function isAutoPx( prop ) {
// The first test is used to ensure that:
// 1. The prop starts with a lowercase letter (as we uppercase it for the second regex).
// 2. The prop is not empty.
return ralphaStart.test( prop ) &&
rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) );
origFnCss = jQuery.fn.css;
migratePatchFunc( jQuery.fn, "css", function( name, value ) {
if ( name && typeof name === "object" && !Array.isArray( name ) ) {
jQuery.each( name, function( n, v ) {
jQuery.fn.css.call( origThis, n, v );
if ( typeof value === "number" ) {
camelName = camelCase( name );
// Use `internalCssNumber` to avoid triggering our warnings in this
if ( !isAutoPx( camelName ) && !internalCssNumber[ camelName ] ) {
migrateWarn( "css-number",
"Number-typed values are deprecated for jQuery.fn.css( \"" +
return origFnCss.apply( this, arguments );
var origData = jQuery.data;
migratePatchFunc( jQuery, "data", function( elem, name, value ) {
var curData, sameKeys, key;
// Name can be an object, and each entry in the object is meant to be set as data
if ( name && typeof name === "object" && arguments.length === 2 ) {
curData = jQuery.hasData( elem ) && origData.call( this, elem );
if ( key !== camelCase( key ) ) {
migrateWarn( "data-camelCase",
"jQuery.data() always sets/gets camelCased names: " + key );
curData[ key ] = name[ key ];
sameKeys[ key ] = name[ key ];
origData.call( this, elem, sameKeys );
// If the name is transformed, look for the un-transformed name in the data object
if ( name && typeof name === "string" && name !== camelCase( name ) ) {
curData = jQuery.hasData( elem ) && origData.call( this, elem );
if ( curData && name in curData ) {
migrateWarn( "data-camelCase",
"jQuery.data() always sets/gets camelCased names: " + name );
if ( arguments.length > 2 ) {
return origData.apply( this, arguments );
// Support jQuery slim which excludes the effects module
var intervalValue, intervalMsg,
oldTweenRun = jQuery.Tween.prototype.run,
linearEasing = function( pct ) {
migratePatchFunc( jQuery.Tween.prototype, "run", function( ) {
if ( jQuery.easing[ this.easing ].length > 1 ) {
"'jQuery.easing." + this.easing.toString() + "' should use only one argument"
jQuery.easing[ this.easing ] = linearEasing;
oldTweenRun.apply( this, arguments );
intervalValue = jQuery.fx.interval;
intervalMsg = "jQuery.fx.interval is deprecated";
// Support: IE9, Android <=4.4
// Avoid false positives on browsers that lack rAF
// Don't warn if document is hidden, jQuery uses setTimeout (#292)
if ( window.requestAnimationFrame ) {
Object.defineProperty( jQuery.fx, "interval", {
if ( !window.document.hidden ) {
migrateWarn( "fx-interval", intervalMsg );
// Only fallback to the default if patch is enabled
if ( !jQuery.migrateIsPatchEnabled( "fx-interval" ) ) {
return intervalValue === undefined ? 13 : intervalValue;
set: function( newValue ) {
migrateWarn( "fx-interval", intervalMsg );
intervalValue = newValue;
var oldLoad = jQuery.fn.load,
oldEventAdd = jQuery.event.add,
originalFix = jQuery.event.fix;
jQuery.event.fixHooks = {};
migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat,
"jQuery.event.props.concat() is deprecated and removed" );
migratePatchFunc( jQuery.event, "fix", function( originalEvent ) {
type = originalEvent.type,
fixHook = this.fixHooks[ type ],
props = jQuery.event.props;
migrateWarn( "event-old-patch",
"jQuery.event.props are deprecated and removed: " + props.join() );
jQuery.event.addProp( props.pop() );
if ( fixHook && !fixHook._migrated_ ) {
fixHook._migrated_ = true;
migrateWarn( "event-old-patch",
"jQuery.event.fixHooks are deprecated and removed: " + type );
if ( ( props = fixHook.props ) && props.length ) {
jQuery.event.addProp( props.pop() );
event = originalFix.call( this, originalEvent );
return fixHook && fixHook.filter ?
fixHook.filter( event, originalEvent ) :
migratePatchFunc( jQuery.event, "add", function( elem, types ) {
// This misses the multiple-types case but that seems awfully rare
if ( elem === window && types === "load" && window.document.readyState === "complete" ) {
migrateWarn( "load-after-event",
"jQuery(window).on('load'...) called after load event occurred" );
return oldEventAdd.apply( this, arguments );
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
migratePatchFunc( jQuery.fn, name, function() {
var args = Array.prototype.slice.call( arguments, 0 );
// If this is an ajax load() the first arg should be the string URL;
// technically this could also be the "Anything" arg of the event .load()
// which just goes to show why this dumb signature has been deprecated!
// jQuery custom builds that exclude the Ajax module justifiably die here.
if ( name === "load" && typeof args[ 0 ] === "string" ) {
return oldLoad.apply( this, args );
migrateWarn( "shorthand-removed-v3",
"jQuery.fn." + name + "() is deprecated" );
args.splice( 0, 0, name );
if ( arguments.length ) {
return this.on.apply( this, args );
// Use .triggerHandler here because:
// - load and unload events don't need to bubble, only applied to window or image
// - error event should not bubble to window, although it does pre-1.7
// See http://bugs.jquery.com/ticket/11820
this.triggerHandler.apply( this, args );
}, "shorthand-removed-v3" );
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup contextmenu" ).split( " " ),
migratePatchAndWarnFunc( jQuery.fn, name, function( data, fn ) {
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
"shorthand-deprecated-v3",
"jQuery.fn." + name + "() event shorthand is deprecated" );
// Trigger "ready" event only once, on document ready
jQuery( window.document ).triggerHandler( "ready" );
jQuery.event.special.ready = {
if ( this === window.document ) {
migrateWarn( "ready-event", "'ready' event is deprecated" );
migratePatchAndWarnFunc( jQuery.fn, "bind", function( types, data, fn ) {
return this.on( types, null, data, fn );
}, "pre-on-methods", "jQuery.fn.bind() is deprecated" );
migratePatchAndWarnFunc( jQuery.fn, "unbind", function( types, fn ) {
return this.off( types, null, fn );
}, "pre-on-methods", "jQuery.fn.unbind() is deprecated" );
migratePatchAndWarnFunc( jQuery.fn, "delegate", function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
}, "pre-on-methods", "jQuery.fn.delegate() is deprecated" );
migratePatchAndWarnFunc( jQuery.fn, "undelegate", function( selector, types, fn ) {
return arguments.length === 1 ?
this.off( selector, "**" ) :
this.off( types, selector || "**", fn );
}, "pre-on-methods", "jQuery.fn.undelegate() is deprecated" );
migratePatchAndWarnFunc( jQuery.fn, "hover", function( fnOver, fnOut ) {
return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver );
}, "pre-on-methods", "jQuery.fn.hover() is deprecated" );
var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
makeMarkup = function( html ) {
var doc = window.document.implementation.createHTMLDocument( "" );
doc.body.innerHTML = html;
return doc.body && doc.body.innerHTML;
warnIfChanged = function( html ) {
var changed = html.replace( rxhtmlTag, "<$1></$2>" );
if ( changed !== html && makeMarkup( html ) !== makeMarkup( changed ) ) {
migrateWarn( "self-closed-tags",
"HTML tags must be properly nested and closed: " + html );
* Deprecated, please use `jQuery.migrateDisablePatches( "self-closed-tags" )` instead.
jQuery.UNSAFE_restoreLegacyHtmlPrefilter = function() {
jQuery.migrateEnablePatches( "self-closed-tags" );
migratePatchFunc( jQuery, "htmlPrefilter", function( html ) {
return html.replace( rxhtmlTag, "<$1></$2>" );
// This patch needs to be disabled by default as it re-introduces
// security issues (CVE-2020-11022, CVE-2020-11023).
jQuery.migrateDisablePatches( "self-closed-tags" );
var origOffset = jQuery.fn.offset;
migratePatchFunc( jQuery.fn, "offset", function() {
if ( elem && ( !elem.nodeType || !elem.getBoundingClientRect ) ) {
migrateWarn( "offset-valid-elem", "jQuery.fn.offset() requires a valid DOM element" );
return arguments.length ? this : undefined;
return origOffset.apply( this, arguments );
}, "offset-valid-elem" );
// Support jQuery slim which excludes the ajax module
// The jQuery.param patch is about respecting `jQuery.ajaxSettings.traditional`
// so it doesn't make sense for the slim build.
var origParam = jQuery.param;
migratePatchFunc( jQuery, "param", function( data, traditional ) {
var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
if ( traditional === undefined && ajaxTraditional ) {
migrateWarn( "param-ajax-traditional",
"jQuery.param() no longer uses jQuery.ajaxSettings.traditional" );
traditional = ajaxTraditional;
return origParam.call( this, data, traditional );
}, "param-ajax-traditional" );
migratePatchAndWarnFunc( jQuery.fn, "andSelf", jQuery.fn.addBack, "andSelf",
"jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" );
// Support jQuery slim which excludes the deferred module in jQuery 4.0+
var oldDeferred = jQuery.Deferred,
// Action, add listener, callbacks, .then handlers, final state
[ "resolve", "done", jQuery.Callbacks( "once memory" ),
jQuery.Callbacks( "once memory" ), "resolved" ],
[ "reject", "fail", jQuery.Callbacks( "once memory" ),
jQuery.Callbacks( "once memory" ), "rejected" ],
[ "notify", "progress", jQuery.Callbacks( "memory" ),
jQuery.Callbacks( "memory" ) ]
migratePatchFunc( jQuery, "Deferred", function( func ) {
var deferred = oldDeferred(),
promise = deferred.promise();
function newDeferredPipe( /* fnDone, fnFail, fnProgress */ ) {
return jQuery.Deferred( function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var fn = typeof fns[ i ] === "function" && fns[ i ];
// Deferred.done(function() { bind to newDefer or newDefer.resolve })
// deferred.fail(function() { bind to newDefer or newDefer.reject })
// deferred.progress(function() { bind to newDefer or newDefer.notify })
deferred[ tuple[ 1 ] ]( function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && typeof returned.promise === "function" ) {
.done( newDefer.resolve )
.progress( newDefer.notify );
newDefer[ tuple[ 0 ] + "With" ](
this === promise ? newDefer.promise() : this,
fn ? [ returned ] : arguments
migratePatchAndWarnFunc( deferred, "pipe", newDeferredPipe, "deferred-pipe",