updated core from 8.4 to 8.5 : bug with login_destination
This commit is contained in:
+27
-34
@@ -152,8 +152,8 @@ window.Drupal = { behaviors: {}, locale: {} };
|
||||
settings = settings || drupalSettings;
|
||||
const behaviors = Drupal.behaviors;
|
||||
// Execute all of them.
|
||||
for (const i in behaviors) {
|
||||
if (behaviors.hasOwnProperty(i) && typeof behaviors[i].attach === 'function') {
|
||||
Object.keys(behaviors || {}).forEach((i) => {
|
||||
if (typeof behaviors[i].attach === 'function') {
|
||||
// Don't stop the execution of behaviors in case of an error.
|
||||
try {
|
||||
behaviors[i].attach(context, settings);
|
||||
@@ -162,7 +162,7 @@ window.Drupal = { behaviors: {}, locale: {} };
|
||||
Drupal.throwError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -212,8 +212,8 @@ window.Drupal = { behaviors: {}, locale: {} };
|
||||
trigger = trigger || 'unload';
|
||||
const behaviors = Drupal.behaviors;
|
||||
// Execute all of them.
|
||||
for (const i in behaviors) {
|
||||
if (behaviors.hasOwnProperty(i) && typeof behaviors[i].detach === 'function') {
|
||||
Object.keys(behaviors || {}).forEach((i) => {
|
||||
if (typeof behaviors[i].detach === 'function') {
|
||||
// Don't stop the execution of behaviors in case of an error.
|
||||
try {
|
||||
behaviors[i].detach(context, settings, trigger);
|
||||
@@ -222,7 +222,7 @@ window.Drupal = { behaviors: {}, locale: {} };
|
||||
Drupal.throwError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -239,9 +239,10 @@ window.Drupal = { behaviors: {}, locale: {} };
|
||||
Drupal.checkPlain = function (str) {
|
||||
str = str.toString()
|
||||
.replace(/&/g, '&')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
return str;
|
||||
};
|
||||
|
||||
@@ -269,26 +270,24 @@ window.Drupal = { behaviors: {}, locale: {} };
|
||||
// Keep args intact.
|
||||
const processedArgs = {};
|
||||
// Transform arguments before inserting them.
|
||||
for (const key in args) {
|
||||
if (args.hasOwnProperty(key)) {
|
||||
switch (key.charAt(0)) {
|
||||
// Escaped only.
|
||||
case '@':
|
||||
processedArgs[key] = Drupal.checkPlain(args[key]);
|
||||
break;
|
||||
Object.keys(args || {}).forEach((key) => {
|
||||
switch (key.charAt(0)) {
|
||||
// Escaped only.
|
||||
case '@':
|
||||
processedArgs[key] = Drupal.checkPlain(args[key]);
|
||||
break;
|
||||
|
||||
// Pass-through.
|
||||
case '!':
|
||||
processedArgs[key] = args[key];
|
||||
break;
|
||||
// Pass-through.
|
||||
case '!':
|
||||
processedArgs[key] = args[key];
|
||||
break;
|
||||
|
||||
// Escaped and placeholder.
|
||||
default:
|
||||
processedArgs[key] = Drupal.theme('placeholder', args[key]);
|
||||
break;
|
||||
}
|
||||
// Escaped and placeholder.
|
||||
default:
|
||||
processedArgs[key] = Drupal.theme('placeholder', args[key]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return Drupal.stringReplace(str, processedArgs, null);
|
||||
};
|
||||
@@ -316,12 +315,7 @@ window.Drupal = { behaviors: {}, locale: {} };
|
||||
|
||||
// If the array of keys is not passed then collect the keys from the args.
|
||||
if (!Array.isArray(keys)) {
|
||||
keys = [];
|
||||
for (const k in args) {
|
||||
if (args.hasOwnProperty(k)) {
|
||||
keys.push(k);
|
||||
}
|
||||
}
|
||||
keys = Object.keys(args || {});
|
||||
|
||||
// Order the keys by the character length. The shortest one is the first.
|
||||
keys.sort((a, b) => a.length - b.length);
|
||||
@@ -559,10 +553,9 @@ window.Drupal = { behaviors: {}, locale: {} };
|
||||
* Any data the theme function returns. This could be a plain HTML string,
|
||||
* but also a complex object.
|
||||
*/
|
||||
Drupal.theme = function (func) {
|
||||
const args = Array.prototype.slice.apply(arguments, [1]);
|
||||
Drupal.theme = function (func, ...args) {
|
||||
if (func in Drupal.theme) {
|
||||
return Drupal.theme[func].apply(this, args);
|
||||
return Drupal.theme[func](...args);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user