projects
/
yaffs-website
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website]
/
web
/
core
/
misc
/
drupal.js
diff --git
a/web/core/misc/drupal.js
b/web/core/misc/drupal.js
index f0c2b72243f75a53877b093f9d2dbe0076fde103..4e3389358e14ddc3acc33c4220ad0cb1e80b9639 100644
(file)
--- a/
web/core/misc/drupal.js
+++ b/
web/core/misc/drupal.js
@@
-19,15
+19,15
@@
window.Drupal = { behaviors: {}, locale: {} };
settings = settings || drupalSettings;
var behaviors = Drupal.behaviors;
settings = settings || drupalSettings;
var behaviors = Drupal.behaviors;
-
for (var i in behaviors
) {
- if (
behaviors.hasOwnProperty(i) &&
typeof behaviors[i].attach === 'function') {
+
Object.keys(behaviors || {}).forEach(function (i
) {
+ if (typeof behaviors[i].attach === 'function') {
try {
behaviors[i].attach(context, settings);
} catch (e) {
Drupal.throwError(e);
}
}
try {
behaviors[i].attach(context, settings);
} catch (e) {
Drupal.throwError(e);
}
}
- }
+ }
);
};
Drupal.detachBehaviors = function (context, settings, trigger) {
};
Drupal.detachBehaviors = function (context, settings, trigger) {
@@
-36,15
+36,15
@@
window.Drupal = { behaviors: {}, locale: {} };
trigger = trigger || 'unload';
var behaviors = Drupal.behaviors;
trigger = trigger || 'unload';
var behaviors = Drupal.behaviors;
-
for (var i in behaviors
) {
- if (
behaviors.hasOwnProperty(i) &&
typeof behaviors[i].detach === 'function') {
+
Object.keys(behaviors || {}).forEach(function (i
) {
+ if (typeof behaviors[i].detach === 'function') {
try {
behaviors[i].detach(context, settings, trigger);
} catch (e) {
Drupal.throwError(e);
}
}
try {
behaviors[i].detach(context, settings, trigger);
} catch (e) {
Drupal.throwError(e);
}
}
- }
+ }
);
};
Drupal.checkPlain = function (str) {
};
Drupal.checkPlain = function (str) {
@@
-55,23
+55,21
@@
window.Drupal = { behaviors: {}, locale: {} };
Drupal.formatString = function (str, args) {
var processedArgs = {};
Drupal.formatString = function (str, args) {
var processedArgs = {};
- for (var key in args) {
- if (args.hasOwnProperty(key)) {
- switch (key.charAt(0)) {
- case '@':
- processedArgs[key] = Drupal.checkPlain(args[key]);
- break;
+ Object.keys(args || {}).forEach(function (key) {
+ switch (key.charAt(0)) {
+ case '@':
+ processedArgs[key] = Drupal.checkPlain(args[key]);
+ break;
-
case '!':
-
processedArgs[key] = args[key];
-
break;
+ case '!':
+ processedArgs[key] = args[key];
+ break;
- default:
- processedArgs[key] = Drupal.theme('placeholder', args[key]);
- break;
- }
+ default:
+ processedArgs[key] = Drupal.theme('placeholder', args[key]);
+ break;
}
}
- }
+ }
);
return Drupal.stringReplace(str, processedArgs, null);
};
return Drupal.stringReplace(str, processedArgs, null);
};
@@
-82,12
+80,7
@@
window.Drupal = { behaviors: {}, locale: {} };
}
if (!Array.isArray(keys)) {
}
if (!Array.isArray(keys)) {
- keys = [];
- for (var k in args) {
- if (args.hasOwnProperty(k)) {
- keys.push(k);
- }
- }
+ keys = Object.keys(args || {});
keys.sort(function (a, b) {
return a.length - b.length;
keys.sort(function (a, b) {
return a.length - b.length;
@@
-142,12
+135,12
@@
window.Drupal = { behaviors: {}, locale: {} };
Drupal.url.isLocal = function (url) {
var absoluteUrl = Drupal.url.toAbsolute(url);
Drupal.url.isLocal = function (url) {
var absoluteUrl = Drupal.url.toAbsolute(url);
- var protocol = location.protocol;
+ var protocol =
window.
location.protocol;
if (protocol === 'http:' && absoluteUrl.indexOf('https:') === 0) {
protocol = 'https:';
}
if (protocol === 'http:' && absoluteUrl.indexOf('https:') === 0) {
protocol = 'https:';
}
- var baseUrl = protocol + '//' + location.host + drupalSettings.path.baseUrl.slice(0, -1);
+ var baseUrl = protocol + '//' +
window.
location.host + drupalSettings.path.baseUrl.slice(0, -1);
try {
absoluteUrl = decodeURIComponent(absoluteUrl);
try {
absoluteUrl = decodeURIComponent(absoluteUrl);
@@
-181,9
+174,14
@@
window.Drupal = { behaviors: {}, locale: {} };
};
Drupal.theme = function (func) {
};
Drupal.theme = function (func) {
- var args = Array.prototype.slice.apply(arguments, [1]);
if (func in Drupal.theme) {
if (func in Drupal.theme) {
- return Drupal.theme[func].apply(this, args);
+ var _Drupal$theme;
+
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ return (_Drupal$theme = Drupal.theme)[func].apply(_Drupal$theme, args);
}
};
}
};