Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,16 @@
'sfwdt' + token,
'{{ url("_wdt", { "token": "xxxxxx" })|escape('js') }}'.replace(/xxxxxx/, newToken),
function(xhr, el) {
var toolbarContent = document.getElementById('sfToolbarMainContent-' + newToken);

/* Do nothing in the edge case where the toolbar has already been replaced with a new one */
if (!document.getElementById('sfToolbarMainContent-' + newToken)) {
if (!toolbarContent) {
return;
}

/* Replace the ID, it has to match the new token */
toolbarContent.parentElement.id = 'sfwdt' + newToken;

/* Evaluate in global scope scripts embedded inside the toolbar */
var i, scripts = [].slice.call(el.querySelectorAll('script'));
for (i = 0; i < scripts.length; ++i) {
Expand Down