summaryrefslogtreecommitdiffstatshomepage
path: root/core/misc/drupal.es6.js
diff options
context:
space:
mode:
authorcatch <catch@35733.no-reply.drupal.org>2020-10-21 11:41:33 +0100
committercatch <catch@35733.no-reply.drupal.org>2020-10-21 11:41:33 +0100
commit89f6acb734e93d22468e25f59e0bf59ca2d8aaa5 (patch)
treed594c0079c7c557feb5fbcbb76c3a67eca744d8f /core/misc/drupal.es6.js
parentda115f6ccffb6c9aeb368b56b8664332968a65e6 (diff)
downloaddrupal-89f6acb734e93d22468e25f59e0bf59ca2d8aaa5.tar.gz
drupal-89f6acb734e93d22468e25f59e0bf59ca2d8aaa5.zip
Issue #3174884 by raman.b, alexpott, lauriii, zrpnr, nod_: Update yarn dependencies for Drupal 9.1.0
Diffstat (limited to 'core/misc/drupal.es6.js')
-rw-r--r--core/misc/drupal.es6.js43
1 files changed, 25 insertions, 18 deletions
diff --git a/core/misc/drupal.es6.js b/core/misc/drupal.es6.js
index 48e5f7e2f093..f3e314db5dd7 100644
--- a/core/misc/drupal.es6.js
+++ b/core/misc/drupal.es6.js
@@ -42,7 +42,14 @@ window.Drupal = { behaviors: {}, locale: {} };
// JavaScript should be made compatible with libraries other than jQuery by
// wrapping it in an anonymous closure.
-(function(Drupal, drupalSettings, drupalTranslations, console, Proxy, Reflect) {
+(function (
+ Drupal,
+ drupalSettings,
+ drupalTranslations,
+ console,
+ Proxy,
+ Reflect,
+) {
/**
* Helper to rethrow errors asynchronously.
*
@@ -52,7 +59,7 @@ window.Drupal = { behaviors: {}, locale: {} };
* @param {Error|string} error
* The error to be thrown.
*/
- Drupal.throwError = function(error) {
+ Drupal.throwError = function (error) {
setTimeout(() => {
throw error;
}, 0);
@@ -147,12 +154,12 @@ window.Drupal = { behaviors: {}, locale: {} };
*
* @throws {Drupal~DrupalBehaviorError}
*/
- Drupal.attachBehaviors = function(context, settings) {
+ Drupal.attachBehaviors = function (context, settings) {
context = context || document;
settings = settings || drupalSettings;
const behaviors = Drupal.behaviors;
// Execute all of them.
- Object.keys(behaviors || {}).forEach(i => {
+ Object.keys(behaviors || {}).forEach((i) => {
if (typeof behaviors[i].attach === 'function') {
// Don't stop the execution of behaviors in case of an error.
try {
@@ -205,13 +212,13 @@ window.Drupal = { behaviors: {}, locale: {} };
* @see Drupal~behaviorDetach
* @see Drupal.attachBehaviors
*/
- Drupal.detachBehaviors = function(context, settings, trigger) {
+ Drupal.detachBehaviors = function (context, settings, trigger) {
context = context || document;
settings = settings || drupalSettings;
trigger = trigger || 'unload';
const behaviors = Drupal.behaviors;
// Execute all of them.
- Object.keys(behaviors || {}).forEach(i => {
+ Object.keys(behaviors || {}).forEach((i) => {
if (typeof behaviors[i].detach === 'function') {
// Don't stop the execution of behaviors in case of an error.
try {
@@ -234,7 +241,7 @@ window.Drupal = { behaviors: {}, locale: {} };
*
* @ingroup sanitization
*/
- Drupal.checkPlain = function(str) {
+ Drupal.checkPlain = function (str) {
str = str
.toString()
.replace(/&/g, '&amp;')
@@ -265,11 +272,11 @@ window.Drupal = { behaviors: {}, locale: {} };
*
* @see Drupal.t
*/
- Drupal.formatString = function(str, args) {
+ Drupal.formatString = function (str, args) {
// Keep args intact.
const processedArgs = {};
// Transform arguments before inserting them.
- Object.keys(args || {}).forEach(key => {
+ Object.keys(args || {}).forEach((key) => {
switch (key.charAt(0)) {
// Escaped only.
case '@':
@@ -307,7 +314,7 @@ window.Drupal = { behaviors: {}, locale: {} };
* @return {string}
* The replaced string.
*/
- Drupal.stringReplace = function(str, args, keys) {
+ Drupal.stringReplace = function (str, args, keys) {
if (str.length === 0) {
return str;
}
@@ -358,7 +365,7 @@ window.Drupal = { behaviors: {}, locale: {} };
* The formatted string.
* The translated string.
*/
- Drupal.t = function(str, args, options) {
+ Drupal.t = function (str, args, options) {
options = options || {};
options.context = options.context || '';
@@ -387,7 +394,7 @@ window.Drupal = { behaviors: {}, locale: {} };
* @return {string}
* The full URL.
*/
- Drupal.url = function(path) {
+ Drupal.url = function (path) {
return drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix + path;
};
@@ -404,7 +411,7 @@ window.Drupal = { behaviors: {}, locale: {} };
* @see https://grack.com/blog/2009/11/17/absolutizing-url-in-javascript
* @see https://github.com/jquery/jquery-ui/blob/1.11.4/ui/tabs.js#L53
*/
- Drupal.url.toAbsolute = function(url) {
+ Drupal.url.toAbsolute = function (url) {
const urlParsingNode = document.createElement('a');
// Decode the URL first; this is required by IE <= 6. Decoding non-UTF-8
@@ -433,7 +440,7 @@ window.Drupal = { behaviors: {}, locale: {} };
*
* @see https://github.com/jquery/jquery-ui/blob/1.11.4/ui/tabs.js#L58
*/
- Drupal.url.isLocal = function(url) {
+ Drupal.url.isLocal = function (url) {
// Always use browser-derived absolute URLs in the comparison, to avoid
// attempts to break out of the base path using directory traversal.
let absoluteUrl = Drupal.url.toAbsolute(url);
@@ -498,7 +505,7 @@ window.Drupal = { behaviors: {}, locale: {} };
* @return {string}
* A translated string.
*/
- Drupal.formatPlural = function(count, singular, plural, args, options) {
+ Drupal.formatPlural = function (count, singular, plural, args, options) {
args = args || {};
args['@count'] = count;
@@ -537,7 +544,7 @@ window.Drupal = { behaviors: {}, locale: {} };
* @return {string}
* The encoded path.
*/
- Drupal.encodePath = function(item) {
+ Drupal.encodePath = function (item) {
return window.encodeURIComponent(item).replace(/%2F/g, '/');
};
@@ -620,7 +627,7 @@ 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, ...args) {
+ Drupal.theme = function (func, ...args) {
if (func in Drupal.theme) {
return Drupal.theme[func](...args);
}
@@ -635,7 +642,7 @@ window.Drupal = { behaviors: {}, locale: {} };
* @return {string}
* The formatted text (html).
*/
- Drupal.theme.placeholder = function(str) {
+ Drupal.theme.placeholder = function (str) {
return `<em class="placeholder">${Drupal.checkPlain(str)}</em>`;
};
})(