Edit File by line
/home/barbar84/www/wp-inclu.../js
File: customize-selective-refresh.js
/**
[0] Fix | Delete
* @output wp-includes/js/customize-selective-refresh.js
[1] Fix | Delete
*/
[2] Fix | Delete
[3] Fix | Delete
/* global jQuery, JSON, _customizePartialRefreshExports, console */
[4] Fix | Delete
[5] Fix | Delete
/** @namespace wp.customize.selectiveRefresh */
[6] Fix | Delete
wp.customize.selectiveRefresh = ( function( $, api ) {
[7] Fix | Delete
'use strict';
[8] Fix | Delete
var self, Partial, Placement;
[9] Fix | Delete
[10] Fix | Delete
self = {
[11] Fix | Delete
ready: $.Deferred(),
[12] Fix | Delete
editShortcutVisibility: new api.Value(),
[13] Fix | Delete
data: {
[14] Fix | Delete
partials: {},
[15] Fix | Delete
renderQueryVar: '',
[16] Fix | Delete
l10n: {
[17] Fix | Delete
shiftClickToEdit: ''
[18] Fix | Delete
}
[19] Fix | Delete
},
[20] Fix | Delete
currentRequest: null
[21] Fix | Delete
};
[22] Fix | Delete
[23] Fix | Delete
_.extend( self, api.Events );
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* A Customizer Partial.
[27] Fix | Delete
*
[28] Fix | Delete
* A partial provides a rendering of one or more settings according to a template.
[29] Fix | Delete
*
[30] Fix | Delete
* @memberOf wp.customize.selectiveRefresh
[31] Fix | Delete
*
[32] Fix | Delete
* @see PHP class WP_Customize_Partial.
[33] Fix | Delete
*
[34] Fix | Delete
* @class
[35] Fix | Delete
* @augments wp.customize.Class
[36] Fix | Delete
* @since 4.5.0
[37] Fix | Delete
*/
[38] Fix | Delete
Partial = self.Partial = api.Class.extend(/** @lends wp.customize.SelectiveRefresh.Partial.prototype */{
[39] Fix | Delete
[40] Fix | Delete
id: null,
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* Default params.
[44] Fix | Delete
*
[45] Fix | Delete
* @since 4.9.0
[46] Fix | Delete
* @var {object}
[47] Fix | Delete
*/
[48] Fix | Delete
defaults: {
[49] Fix | Delete
selector: null,
[50] Fix | Delete
primarySetting: null,
[51] Fix | Delete
containerInclusive: false,
[52] Fix | Delete
fallbackRefresh: true // Note this needs to be false in a front-end editing context.
[53] Fix | Delete
},
[54] Fix | Delete
[55] Fix | Delete
/**
[56] Fix | Delete
* Constructor.
[57] Fix | Delete
*
[58] Fix | Delete
* @since 4.5.0
[59] Fix | Delete
*
[60] Fix | Delete
* @param {string} id - Unique identifier for the partial instance.
[61] Fix | Delete
* @param {Object} options - Options hash for the partial instance.
[62] Fix | Delete
* @param {string} options.type - Type of partial (e.g. nav_menu, widget, etc)
[63] Fix | Delete
* @param {string} options.selector - jQuery selector to find the container element in the page.
[64] Fix | Delete
* @param {Array} options.settings - The IDs for the settings the partial relates to.
[65] Fix | Delete
* @param {string} options.primarySetting - The ID for the primary setting the partial renders.
[66] Fix | Delete
* @param {boolean} options.fallbackRefresh - Whether to refresh the entire preview in case of a partial refresh failure.
[67] Fix | Delete
* @param {Object} [options.params] - Deprecated wrapper for the above properties.
[68] Fix | Delete
*/
[69] Fix | Delete
initialize: function( id, options ) {
[70] Fix | Delete
var partial = this;
[71] Fix | Delete
options = options || {};
[72] Fix | Delete
partial.id = id;
[73] Fix | Delete
[74] Fix | Delete
partial.params = _.extend(
[75] Fix | Delete
{
[76] Fix | Delete
settings: []
[77] Fix | Delete
},
[78] Fix | Delete
partial.defaults,
[79] Fix | Delete
options.params || options
[80] Fix | Delete
);
[81] Fix | Delete
[82] Fix | Delete
partial.deferred = {};
[83] Fix | Delete
partial.deferred.ready = $.Deferred();
[84] Fix | Delete
[85] Fix | Delete
partial.deferred.ready.done( function() {
[86] Fix | Delete
partial.ready();
[87] Fix | Delete
} );
[88] Fix | Delete
},
[89] Fix | Delete
[90] Fix | Delete
/**
[91] Fix | Delete
* Set up the partial.
[92] Fix | Delete
*
[93] Fix | Delete
* @since 4.5.0
[94] Fix | Delete
*/
[95] Fix | Delete
ready: function() {
[96] Fix | Delete
var partial = this;
[97] Fix | Delete
_.each( partial.placements(), function( placement ) {
[98] Fix | Delete
$( placement.container ).attr( 'title', self.data.l10n.shiftClickToEdit );
[99] Fix | Delete
partial.createEditShortcutForPlacement( placement );
[100] Fix | Delete
} );
[101] Fix | Delete
$( document ).on( 'click', partial.params.selector, function( e ) {
[102] Fix | Delete
if ( ! e.shiftKey ) {
[103] Fix | Delete
return;
[104] Fix | Delete
}
[105] Fix | Delete
e.preventDefault();
[106] Fix | Delete
_.each( partial.placements(), function( placement ) {
[107] Fix | Delete
if ( $( placement.container ).is( e.currentTarget ) ) {
[108] Fix | Delete
partial.showControl();
[109] Fix | Delete
}
[110] Fix | Delete
} );
[111] Fix | Delete
} );
[112] Fix | Delete
},
[113] Fix | Delete
[114] Fix | Delete
/**
[115] Fix | Delete
* Create and show the edit shortcut for a given partial placement container.
[116] Fix | Delete
*
[117] Fix | Delete
* @since 4.7.0
[118] Fix | Delete
* @access public
[119] Fix | Delete
*
[120] Fix | Delete
* @param {Placement} placement The placement container element.
[121] Fix | Delete
* @return {void}
[122] Fix | Delete
*/
[123] Fix | Delete
createEditShortcutForPlacement: function( placement ) {
[124] Fix | Delete
var partial = this, $shortcut, $placementContainer, illegalAncestorSelector, illegalContainerSelector;
[125] Fix | Delete
if ( ! placement.container ) {
[126] Fix | Delete
return;
[127] Fix | Delete
}
[128] Fix | Delete
$placementContainer = $( placement.container );
[129] Fix | Delete
illegalAncestorSelector = 'head';
[130] Fix | Delete
illegalContainerSelector = 'area, audio, base, bdi, bdo, br, button, canvas, col, colgroup, command, datalist, embed, head, hr, html, iframe, img, input, keygen, label, link, map, math, menu, meta, noscript, object, optgroup, option, param, progress, rp, rt, ruby, script, select, source, style, svg, table, tbody, textarea, tfoot, thead, title, tr, track, video, wbr';
[131] Fix | Delete
if ( ! $placementContainer.length || $placementContainer.is( illegalContainerSelector ) || $placementContainer.closest( illegalAncestorSelector ).length ) {
[132] Fix | Delete
return;
[133] Fix | Delete
}
[134] Fix | Delete
$shortcut = partial.createEditShortcut();
[135] Fix | Delete
$shortcut.on( 'click', function( event ) {
[136] Fix | Delete
event.preventDefault();
[137] Fix | Delete
event.stopPropagation();
[138] Fix | Delete
partial.showControl();
[139] Fix | Delete
} );
[140] Fix | Delete
partial.addEditShortcutToPlacement( placement, $shortcut );
[141] Fix | Delete
},
[142] Fix | Delete
[143] Fix | Delete
/**
[144] Fix | Delete
* Add an edit shortcut to the placement container.
[145] Fix | Delete
*
[146] Fix | Delete
* @since 4.7.0
[147] Fix | Delete
* @access public
[148] Fix | Delete
*
[149] Fix | Delete
* @param {Placement} placement The placement for the partial.
[150] Fix | Delete
* @param {jQuery} $editShortcut The shortcut element as a jQuery object.
[151] Fix | Delete
* @return {void}
[152] Fix | Delete
*/
[153] Fix | Delete
addEditShortcutToPlacement: function( placement, $editShortcut ) {
[154] Fix | Delete
var $placementContainer = $( placement.container );
[155] Fix | Delete
$placementContainer.prepend( $editShortcut );
[156] Fix | Delete
if ( ! $placementContainer.is( ':visible' ) || 'none' === $placementContainer.css( 'display' ) ) {
[157] Fix | Delete
$editShortcut.addClass( 'customize-partial-edit-shortcut-hidden' );
[158] Fix | Delete
}
[159] Fix | Delete
},
[160] Fix | Delete
[161] Fix | Delete
/**
[162] Fix | Delete
* Return the unique class name for the edit shortcut button for this partial.
[163] Fix | Delete
*
[164] Fix | Delete
* @since 4.7.0
[165] Fix | Delete
* @access public
[166] Fix | Delete
*
[167] Fix | Delete
* @return {string} Partial ID converted into a class name for use in shortcut.
[168] Fix | Delete
*/
[169] Fix | Delete
getEditShortcutClassName: function() {
[170] Fix | Delete
var partial = this, cleanId;
[171] Fix | Delete
cleanId = partial.id.replace( /]/g, '' ).replace( /\[/g, '-' );
[172] Fix | Delete
return 'customize-partial-edit-shortcut-' + cleanId;
[173] Fix | Delete
},
[174] Fix | Delete
[175] Fix | Delete
/**
[176] Fix | Delete
* Return the appropriate translated string for the edit shortcut button.
[177] Fix | Delete
*
[178] Fix | Delete
* @since 4.7.0
[179] Fix | Delete
* @access public
[180] Fix | Delete
*
[181] Fix | Delete
* @return {string} Tooltip for edit shortcut.
[182] Fix | Delete
*/
[183] Fix | Delete
getEditShortcutTitle: function() {
[184] Fix | Delete
var partial = this, l10n = self.data.l10n;
[185] Fix | Delete
switch ( partial.getType() ) {
[186] Fix | Delete
case 'widget':
[187] Fix | Delete
return l10n.clickEditWidget;
[188] Fix | Delete
case 'blogname':
[189] Fix | Delete
return l10n.clickEditTitle;
[190] Fix | Delete
case 'blogdescription':
[191] Fix | Delete
return l10n.clickEditTitle;
[192] Fix | Delete
case 'nav_menu':
[193] Fix | Delete
return l10n.clickEditMenu;
[194] Fix | Delete
default:
[195] Fix | Delete
return l10n.clickEditMisc;
[196] Fix | Delete
}
[197] Fix | Delete
},
[198] Fix | Delete
[199] Fix | Delete
/**
[200] Fix | Delete
* Return the type of this partial
[201] Fix | Delete
*
[202] Fix | Delete
* Will use `params.type` if set, but otherwise will try to infer type from settingId.
[203] Fix | Delete
*
[204] Fix | Delete
* @since 4.7.0
[205] Fix | Delete
* @access public
[206] Fix | Delete
*
[207] Fix | Delete
* @return {string} Type of partial derived from type param or the related setting ID.
[208] Fix | Delete
*/
[209] Fix | Delete
getType: function() {
[210] Fix | Delete
var partial = this, settingId;
[211] Fix | Delete
settingId = partial.params.primarySetting || _.first( partial.settings() ) || 'unknown';
[212] Fix | Delete
if ( partial.params.type ) {
[213] Fix | Delete
return partial.params.type;
[214] Fix | Delete
}
[215] Fix | Delete
if ( settingId.match( /^nav_menu_instance\[/ ) ) {
[216] Fix | Delete
return 'nav_menu';
[217] Fix | Delete
}
[218] Fix | Delete
if ( settingId.match( /^widget_.+\[\d+]$/ ) ) {
[219] Fix | Delete
return 'widget';
[220] Fix | Delete
}
[221] Fix | Delete
return settingId;
[222] Fix | Delete
},
[223] Fix | Delete
[224] Fix | Delete
/**
[225] Fix | Delete
* Create an edit shortcut button for this partial.
[226] Fix | Delete
*
[227] Fix | Delete
* @since 4.7.0
[228] Fix | Delete
* @access public
[229] Fix | Delete
*
[230] Fix | Delete
* @return {jQuery} The edit shortcut button element.
[231] Fix | Delete
*/
[232] Fix | Delete
createEditShortcut: function() {
[233] Fix | Delete
var partial = this, shortcutTitle, $buttonContainer, $button, $image;
[234] Fix | Delete
shortcutTitle = partial.getEditShortcutTitle();
[235] Fix | Delete
$buttonContainer = $( '<span>', {
[236] Fix | Delete
'class': 'customize-partial-edit-shortcut ' + partial.getEditShortcutClassName()
[237] Fix | Delete
} );
[238] Fix | Delete
$button = $( '<button>', {
[239] Fix | Delete
'aria-label': shortcutTitle,
[240] Fix | Delete
'title': shortcutTitle,
[241] Fix | Delete
'class': 'customize-partial-edit-shortcut-button'
[242] Fix | Delete
} );
[243] Fix | Delete
$image = $( '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M13.89 3.39l2.71 2.72c.46.46.42 1.24.03 1.64l-8.01 8.02-5.56 1.16 1.16-5.58s7.6-7.63 7.99-8.03c.39-.39 1.22-.39 1.68.07zm-2.73 2.79l-5.59 5.61 1.11 1.11 5.54-5.65zm-2.97 8.23l5.58-5.6-1.07-1.08-5.59 5.6z"/></svg>' );
[244] Fix | Delete
$button.append( $image );
[245] Fix | Delete
$buttonContainer.append( $button );
[246] Fix | Delete
return $buttonContainer;
[247] Fix | Delete
},
[248] Fix | Delete
[249] Fix | Delete
/**
[250] Fix | Delete
* Find all placements for this partial in the document.
[251] Fix | Delete
*
[252] Fix | Delete
* @since 4.5.0
[253] Fix | Delete
*
[254] Fix | Delete
* @return {Array.<Placement>}
[255] Fix | Delete
*/
[256] Fix | Delete
placements: function() {
[257] Fix | Delete
var partial = this, selector;
[258] Fix | Delete
[259] Fix | Delete
selector = partial.params.selector || '';
[260] Fix | Delete
if ( selector ) {
[261] Fix | Delete
selector += ', ';
[262] Fix | Delete
}
[263] Fix | Delete
selector += '[data-customize-partial-id="' + partial.id + '"]'; // @todo Consider injecting customize-partial-id-${id} classnames instead.
[264] Fix | Delete
[265] Fix | Delete
return $( selector ).map( function() {
[266] Fix | Delete
var container = $( this ), context;
[267] Fix | Delete
[268] Fix | Delete
context = container.data( 'customize-partial-placement-context' );
[269] Fix | Delete
if ( _.isString( context ) && '{' === context.substr( 0, 1 ) ) {
[270] Fix | Delete
throw new Error( 'context JSON parse error' );
[271] Fix | Delete
}
[272] Fix | Delete
[273] Fix | Delete
return new Placement( {
[274] Fix | Delete
partial: partial,
[275] Fix | Delete
container: container,
[276] Fix | Delete
context: context
[277] Fix | Delete
} );
[278] Fix | Delete
} ).get();
[279] Fix | Delete
},
[280] Fix | Delete
[281] Fix | Delete
/**
[282] Fix | Delete
* Get list of setting IDs related to this partial.
[283] Fix | Delete
*
[284] Fix | Delete
* @since 4.5.0
[285] Fix | Delete
*
[286] Fix | Delete
* @return {string[]}
[287] Fix | Delete
*/
[288] Fix | Delete
settings: function() {
[289] Fix | Delete
var partial = this;
[290] Fix | Delete
if ( partial.params.settings && 0 !== partial.params.settings.length ) {
[291] Fix | Delete
return partial.params.settings;
[292] Fix | Delete
} else if ( partial.params.primarySetting ) {
[293] Fix | Delete
return [ partial.params.primarySetting ];
[294] Fix | Delete
} else {
[295] Fix | Delete
return [ partial.id ];
[296] Fix | Delete
}
[297] Fix | Delete
},
[298] Fix | Delete
[299] Fix | Delete
/**
[300] Fix | Delete
* Return whether the setting is related to the partial.
[301] Fix | Delete
*
[302] Fix | Delete
* @since 4.5.0
[303] Fix | Delete
*
[304] Fix | Delete
* @param {wp.customize.Value|string} setting ID or object for setting.
[305] Fix | Delete
* @return {boolean} Whether the setting is related to the partial.
[306] Fix | Delete
*/
[307] Fix | Delete
isRelatedSetting: function( setting /*... newValue, oldValue */ ) {
[308] Fix | Delete
var partial = this;
[309] Fix | Delete
if ( _.isString( setting ) ) {
[310] Fix | Delete
setting = api( setting );
[311] Fix | Delete
}
[312] Fix | Delete
if ( ! setting ) {
[313] Fix | Delete
return false;
[314] Fix | Delete
}
[315] Fix | Delete
return -1 !== _.indexOf( partial.settings(), setting.id );
[316] Fix | Delete
},
[317] Fix | Delete
[318] Fix | Delete
/**
[319] Fix | Delete
* Show the control to modify this partial's setting(s).
[320] Fix | Delete
*
[321] Fix | Delete
* This may be overridden for inline editing.
[322] Fix | Delete
*
[323] Fix | Delete
* @since 4.5.0
[324] Fix | Delete
*/
[325] Fix | Delete
showControl: function() {
[326] Fix | Delete
var partial = this, settingId = partial.params.primarySetting;
[327] Fix | Delete
if ( ! settingId ) {
[328] Fix | Delete
settingId = _.first( partial.settings() );
[329] Fix | Delete
}
[330] Fix | Delete
if ( partial.getType() === 'nav_menu' ) {
[331] Fix | Delete
if ( partial.params.navMenuArgs.theme_location ) {
[332] Fix | Delete
settingId = 'nav_menu_locations[' + partial.params.navMenuArgs.theme_location + ']';
[333] Fix | Delete
} else if ( partial.params.navMenuArgs.menu ) {
[334] Fix | Delete
settingId = 'nav_menu[' + String( partial.params.navMenuArgs.menu ) + ']';
[335] Fix | Delete
}
[336] Fix | Delete
}
[337] Fix | Delete
api.preview.send( 'focus-control-for-setting', settingId );
[338] Fix | Delete
},
[339] Fix | Delete
[340] Fix | Delete
/**
[341] Fix | Delete
* Prepare container for selective refresh.
[342] Fix | Delete
*
[343] Fix | Delete
* @since 4.5.0
[344] Fix | Delete
*
[345] Fix | Delete
* @param {Placement} placement
[346] Fix | Delete
*/
[347] Fix | Delete
preparePlacement: function( placement ) {
[348] Fix | Delete
$( placement.container ).addClass( 'customize-partial-refreshing' );
[349] Fix | Delete
},
[350] Fix | Delete
[351] Fix | Delete
/**
[352] Fix | Delete
* Reference to the pending promise returned from self.requestPartial().
[353] Fix | Delete
*
[354] Fix | Delete
* @since 4.5.0
[355] Fix | Delete
* @private
[356] Fix | Delete
*/
[357] Fix | Delete
_pendingRefreshPromise: null,
[358] Fix | Delete
[359] Fix | Delete
/**
[360] Fix | Delete
* Request the new partial and render it into the placements.
[361] Fix | Delete
*
[362] Fix | Delete
* @since 4.5.0
[363] Fix | Delete
*
[364] Fix | Delete
* @this {wp.customize.selectiveRefresh.Partial}
[365] Fix | Delete
* @return {jQuery.Promise}
[366] Fix | Delete
*/
[367] Fix | Delete
refresh: function() {
[368] Fix | Delete
var partial = this, refreshPromise;
[369] Fix | Delete
[370] Fix | Delete
refreshPromise = self.requestPartial( partial );
[371] Fix | Delete
[372] Fix | Delete
if ( ! partial._pendingRefreshPromise ) {
[373] Fix | Delete
_.each( partial.placements(), function( placement ) {
[374] Fix | Delete
partial.preparePlacement( placement );
[375] Fix | Delete
} );
[376] Fix | Delete
[377] Fix | Delete
refreshPromise.done( function( placements ) {
[378] Fix | Delete
_.each( placements, function( placement ) {
[379] Fix | Delete
partial.renderContent( placement );
[380] Fix | Delete
} );
[381] Fix | Delete
} );
[382] Fix | Delete
[383] Fix | Delete
refreshPromise.fail( function( data, placements ) {
[384] Fix | Delete
partial.fallback( data, placements );
[385] Fix | Delete
} );
[386] Fix | Delete
[387] Fix | Delete
// Allow new request when this one finishes.
[388] Fix | Delete
partial._pendingRefreshPromise = refreshPromise;
[389] Fix | Delete
refreshPromise.always( function() {
[390] Fix | Delete
partial._pendingRefreshPromise = null;
[391] Fix | Delete
} );
[392] Fix | Delete
}
[393] Fix | Delete
[394] Fix | Delete
return refreshPromise;
[395] Fix | Delete
},
[396] Fix | Delete
[397] Fix | Delete
/**
[398] Fix | Delete
* Apply the addedContent in the placement to the document.
[399] Fix | Delete
*
[400] Fix | Delete
* Note the placement object will have its container and removedNodes
[401] Fix | Delete
* properties updated.
[402] Fix | Delete
*
[403] Fix | Delete
* @since 4.5.0
[404] Fix | Delete
*
[405] Fix | Delete
* @param {Placement} placement
[406] Fix | Delete
* @param {Element|jQuery} [placement.container] - This param will be empty if there was no element matching the selector.
[407] Fix | Delete
* @param {string|Object|boolean} placement.addedContent - Rendered HTML content, a data object for JS templates to render, or false if no render.
[408] Fix | Delete
* @param {Object} [placement.context] - Optional context information about the container.
[409] Fix | Delete
* @return {boolean} Whether the rendering was successful and the fallback was not invoked.
[410] Fix | Delete
*/
[411] Fix | Delete
renderContent: function( placement ) {
[412] Fix | Delete
var partial = this, content, newContainerElement;
[413] Fix | Delete
if ( ! placement.container ) {
[414] Fix | Delete
partial.fallback( new Error( 'no_container' ), [ placement ] );
[415] Fix | Delete
return false;
[416] Fix | Delete
}
[417] Fix | Delete
placement.container = $( placement.container );
[418] Fix | Delete
if ( false === placement.addedContent ) {
[419] Fix | Delete
partial.fallback( new Error( 'missing_render' ), [ placement ] );
[420] Fix | Delete
return false;
[421] Fix | Delete
}
[422] Fix | Delete
[423] Fix | Delete
// Currently a subclass needs to override renderContent to handle partials returning data object.
[424] Fix | Delete
if ( ! _.isString( placement.addedContent ) ) {
[425] Fix | Delete
partial.fallback( new Error( 'non_string_content' ), [ placement ] );
[426] Fix | Delete
return false;
[427] Fix | Delete
}
[428] Fix | Delete
[429] Fix | Delete
/* jshint ignore:start */
[430] Fix | Delete
self.orginalDocumentWrite = document.write;
[431] Fix | Delete
document.write = function() {
[432] Fix | Delete
throw new Error( self.data.l10n.badDocumentWrite );
[433] Fix | Delete
};
[434] Fix | Delete
/* jshint ignore:end */
[435] Fix | Delete
try {
[436] Fix | Delete
content = placement.addedContent;
[437] Fix | Delete
if ( wp.emoji && wp.emoji.parse && ! $.contains( document.head, placement.container[0] ) ) {
[438] Fix | Delete
content = wp.emoji.parse( content );
[439] Fix | Delete
}
[440] Fix | Delete
[441] Fix | Delete
if ( partial.params.containerInclusive ) {
[442] Fix | Delete
[443] Fix | Delete
// Note that content may be an empty string, and in this case jQuery will just remove the oldContainer.
[444] Fix | Delete
newContainerElement = $( content );
[445] Fix | Delete
[446] Fix | Delete
// Merge the new context on top of the old context.
[447] Fix | Delete
placement.context = _.extend(
[448] Fix | Delete
placement.context,
[449] Fix | Delete
newContainerElement.data( 'customize-partial-placement-context' ) || {}
[450] Fix | Delete
);
[451] Fix | Delete
newContainerElement.data( 'customize-partial-placement-context', placement.context );
[452] Fix | Delete
[453] Fix | Delete
placement.removedNodes = placement.container;
[454] Fix | Delete
placement.container = newContainerElement;
[455] Fix | Delete
placement.removedNodes.replaceWith( placement.container );
[456] Fix | Delete
placement.container.attr( 'title', self.data.l10n.shiftClickToEdit );
[457] Fix | Delete
} else {
[458] Fix | Delete
placement.removedNodes = document.createDocumentFragment();
[459] Fix | Delete
while ( placement.container[0].firstChild ) {
[460] Fix | Delete
placement.removedNodes.appendChild( placement.container[0].firstChild );
[461] Fix | Delete
}
[462] Fix | Delete
[463] Fix | Delete
placement.container.html( content );
[464] Fix | Delete
}
[465] Fix | Delete
[466] Fix | Delete
placement.container.removeClass( 'customize-render-content-error' );
[467] Fix | Delete
} catch ( error ) {
[468] Fix | Delete
if ( 'undefined' !== typeof console && console.error ) {
[469] Fix | Delete
console.error( partial.id, error );
[470] Fix | Delete
}
[471] Fix | Delete
partial.fallback( error, [ placement ] );
[472] Fix | Delete
}
[473] Fix | Delete
/* jshint ignore:start */
[474] Fix | Delete
document.write = self.orginalDocumentWrite;
[475] Fix | Delete
self.orginalDocumentWrite = null;
[476] Fix | Delete
/* jshint ignore:end */
[477] Fix | Delete
[478] Fix | Delete
partial.createEditShortcutForPlacement( placement );
[479] Fix | Delete
placement.container.removeClass( 'customize-partial-refreshing' );
[480] Fix | Delete
[481] Fix | Delete
// Prevent placement container from being re-triggered as being rendered among nested partials.
[482] Fix | Delete
placement.container.data( 'customize-partial-content-rendered', true );
[483] Fix | Delete
[484] Fix | Delete
/*
[485] Fix | Delete
* Note that the 'wp_audio_shortcode_library' and 'wp_video_shortcode_library' filters
[486] Fix | Delete
* will determine whether or not wp.mediaelement is loaded and whether it will
[487] Fix | Delete
* initialize audio and video respectively. See also https://core.trac.wordpress.org/ticket/40144
[488] Fix | Delete
*/
[489] Fix | Delete
if ( wp.mediaelement ) {
[490] Fix | Delete
wp.mediaelement.initialize();
[491] Fix | Delete
}
[492] Fix | Delete
[493] Fix | Delete
if ( wp.playlist ) {
[494] Fix | Delete
wp.playlist.initialize();
[495] Fix | Delete
}
[496] Fix | Delete
[497] Fix | Delete
/**
[498] Fix | Delete
* Announce when a partial's placement has been rendered so that dynamic elements can be re-built.
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function