: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// Change the context for the click callback to be the main element
iconPosition: props.iconPosition,
showLabel: props.showLabel,
delete props.iconPosition;
if ( typeof props.text === "boolean" ) {
$( "<button></button>", props )
.appendTo( that.uiButtonSet )
.on( "click", function() {
click.apply( that.element[ 0 ], arguments );
this._addClass( this.uiDialog, "ui-dialog-buttons" );
this.uiDialogButtonPane.appendTo( this.uiDialog );
_makeDraggable: function() {
function filteredUi( ui ) {
this.uiDialog.draggable( {
cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
handle: ".ui-dialog-titlebar",
start: function( event, ui ) {
that._addClass( $( this ), "ui-dialog-dragging" );
that._trigger( "dragStart", event, filteredUi( ui ) );
drag: function( event, ui ) {
that._trigger( "drag", event, filteredUi( ui ) );
stop: function( event, ui ) {
var left = ui.offset.left - that.document.scrollLeft(),
top = ui.offset.top - that.document.scrollTop();
at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
"top" + ( top >= 0 ? "+" : "" ) + top,
that._removeClass( $( this ), "ui-dialog-dragging" );
that._trigger( "dragStop", event, filteredUi( ui ) );
_makeResizable: function() {
handles = options.resizable,
// .ui-resizable has position: relative defined in the stylesheet
// but dialogs have to use absolute or fixed positioning
position = this.uiDialog.css( "position" ),
resizeHandles = typeof handles === "string" ?
function filteredUi( ui ) {
originalPosition: ui.originalPosition,
originalSize: ui.originalSize,
this.uiDialog.resizable( {
cancel: ".ui-dialog-content",
alsoResize: this.element,
maxWidth: options.maxWidth,
maxHeight: options.maxHeight,
minWidth: options.minWidth,
minHeight: this._minHeight(),
start: function( event, ui ) {
that._addClass( $( this ), "ui-dialog-resizing" );
that._trigger( "resizeStart", event, filteredUi( ui ) );
resize: function( event, ui ) {
that._trigger( "resize", event, filteredUi( ui ) );
stop: function( event, ui ) {
var offset = that.uiDialog.offset(),
left = offset.left - that.document.scrollLeft(),
top = offset.top - that.document.scrollTop();
options.height = that.uiDialog.height();
options.width = that.uiDialog.width();
at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
"top" + ( top >= 0 ? "+" : "" ) + top,
that._removeClass( $( this ), "ui-dialog-resizing" );
that._trigger( "resizeStop", event, filteredUi( ui ) );
.css( "position", position );
_trackFocus: function() {
this._on( this.widget(), {
focusin: function( event ) {
this._focusedElement = $( event.target );
_makeFocusTarget: function() {
this._trackingInstances().unshift( this );
_untrackInstance: function() {
var instances = this._trackingInstances(),
exists = $.inArray( this, instances );
instances.splice( exists, 1 );
_trackingInstances: function() {
var instances = this.document.data( "ui-dialog-instances" );
this.document.data( "ui-dialog-instances", instances );
var options = this.options;
return options.height === "auto" ?
Math.min( options.minHeight, options.height );
// Need to show the dialog to get the actual offset in the position plugin
var isVisible = this.uiDialog.is( ":visible" );
this.uiDialog.position( this.options.position );
_setOptions: function( options ) {
$.each( options, function( key, value ) {
that._setOption( key, value );
if ( key in that.sizeRelatedOptions ) {
if ( key in that.resizableRelatedOptions ) {
resizableOptions[ key ] = value;
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
this.uiDialog.resizable( "option", resizableOptions );
_setOption: function( key, value ) {
var isDraggable, isResizable,
uiDialog = this.uiDialog;
if ( key === "disabled" ) {
this._super( key, value );
if ( key === "appendTo" ) {
this.uiDialog.appendTo( this._appendTo() );
if ( key === "buttons" ) {
if ( key === "closeText" ) {
this.uiDialogTitlebarClose.button( {
// Ensure that we always pass a string
label: $( "<a>" ).text( "" + this.options.closeText ).html()
if ( key === "draggable" ) {
isDraggable = uiDialog.is( ":data(ui-draggable)" );
if ( isDraggable && !value ) {
uiDialog.draggable( "destroy" );
if ( !isDraggable && value ) {
if ( key === "position" ) {
if ( key === "resizable" ) {
// currently resizable, becoming non-resizable
isResizable = uiDialog.is( ":data(ui-resizable)" );
if ( isResizable && !value ) {
uiDialog.resizable( "destroy" );
// Currently resizable, changing handles
if ( isResizable && typeof value === "string" ) {
uiDialog.resizable( "option", "handles", value );
// Currently non-resizable, becoming resizable
if ( !isResizable && value !== false ) {
this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
// divs will both have width and height set, so we need to reset them
var nonContentHeight, minContentHeight, maxContentHeight,
this.element.show().css( {
if ( options.minWidth > options.width ) {
options.width = options.minWidth;
// determine the height of all the non-content elements
nonContentHeight = this.uiDialog.css( {
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
maxContentHeight = typeof options.maxHeight === "number" ?
Math.max( 0, options.maxHeight - nonContentHeight ) :
if ( options.height === "auto" ) {
minHeight: minContentHeight,
maxHeight: maxContentHeight,
this.element.height( Math.max( 0, options.height - nonContentHeight ) );
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
_blockFrames: function() {
this.iframeBlocks = this.document.find( "iframe" ).map( function() {
width: iframe.outerWidth(),
height: iframe.outerHeight()
.appendTo( iframe.parent() )
.offset( iframe.offset() )[ 0 ];
_unblockFrames: function() {
if ( this.iframeBlocks ) {
this.iframeBlocks.remove();
delete this.iframeBlocks;
_allowInteraction: function( event ) {
if ( $( event.target ).closest( ".ui-dialog" ).length ) {
// TODO: Remove hack when datepicker implements
// the .ui-front logic (#8989)
return !!$( event.target ).closest( ".ui-datepicker" ).length;
_createOverlay: function() {
if ( !this.options.modal ) {
var jqMinor = $.fn.jquery.substring( 0, 4 );
// We use a delay in case the overlay is created from an
// event that we're going to be cancelling (#2804)
this._delay( function() {
if ( !this.document.data( "ui-dialog-overlays" ) ) {
// Prevent use of anchors and inputs
// This doesn't use `_on()` because it is a shared event handler
// across all open modal dialogs.
this.document.on( "focusin.ui-dialog", function( event ) {
var instance = this._trackingInstances()[ 0 ];
if ( !instance._allowInteraction( event ) ) {
instance._focusTabbable();
// Support: jQuery >=3.4 <3.7 only
// In jQuery 3.4-3.6, there are multiple issues with focus/blur
// trigger chains or when triggering is done on a hidden element
// Trigger focus in a delay in addition if needed to avoid the issues.
// See https://github.com/jquery/jquery/issues/4382
// See https://github.com/jquery/jquery/issues/4856
// See https://github.com/jquery/jquery/issues/4950
if ( jqMinor === "3.4." || jqMinor === "3.5." || jqMinor === "3.6." ) {
instance._delay( instance._restoreTabbableFocus );
this.overlay = $( "<div>" )
.appendTo( this._appendTo() );
this._addClass( this.overlay, null, "ui-widget-overlay ui-front" );
this._on( this.overlay, {
this.document.data( "ui-dialog-overlays",
( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 );
_destroyOverlay: function() {
if ( !this.options.modal ) {
var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
this.document.off( "focusin.ui-dialog" );
this.document.removeData( "ui-dialog-overlays" );
this.document.data( "ui-dialog-overlays", overlays );
// TODO: switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {
// Backcompat for dialogClass option
$.widget( "ui.dialog", $.ui.dialog, {
_createWrapper: function() {
this.uiDialog.addClass( this.options.dialogClass );
_setOption: function( key, value ) {
if ( key === "dialogClass" ) {
.removeClass( this.options.dialogClass )
this._superApply( arguments );