diff --git a/core/misc/details-summarized-content.es6.js b/core/misc/details-summarized-content.es6.js index 4408c279fcb..2ed9f9ae6c4 100644 --- a/core/misc/details-summarized-content.es6.js +++ b/core/misc/details-summarized-content.es6.js @@ -74,11 +74,12 @@ attach(context) { const $detailsElements = $(context).find('details').once('details'); - DetailsSummarizedContent.instances = DetailsSummarizedContent.instances.concat( - $detailsElements - .map((index, details) => new DetailsSummarizedContent(details)) - .get(), - ); + DetailsSummarizedContent.instances = + DetailsSummarizedContent.instances.concat( + $detailsElements + .map((index, details) => new DetailsSummarizedContent(details)) + .get(), + ); }, }; diff --git a/core/misc/dialog/dialog.ajax.es6.js b/core/misc/dialog/dialog.ajax.es6.js index e481bdfa5f5..8dca37201b3 100644 --- a/core/misc/dialog/dialog.ajax.es6.js +++ b/core/misc/dialog/dialog.ajax.es6.js @@ -128,9 +128,8 @@ // Move the buttons to the jQuery UI dialog buttons area. if (!response.dialogOptions.buttons) { response.dialogOptions.drupalAutoButtons = true; - response.dialogOptions.buttons = Drupal.behaviors.dialog.prepareDialogButtons( - $dialog, - ); + response.dialogOptions.buttons = + Drupal.behaviors.dialog.prepareDialogButtons($dialog); } // Bind dialogButtonsChange. diff --git a/core/misc/form.es6.js b/core/misc/form.es6.js index ed9fd78cc33..526f24d8b18 100644 --- a/core/misc/form.es6.js +++ b/core/misc/form.es6.js @@ -218,9 +218,8 @@ const $context = $(context); const contextIsForm = $context.is('form'); if (trigger === 'unload') { - const $forms = (contextIsForm - ? $context - : $context.find('form') + const $forms = ( + contextIsForm ? $context : $context.find('form') ).removeOnce('form-updated'); if ($forms.length) { $.makeArray($forms).forEach((form) => { diff --git a/core/misc/tableheader.es6.js b/core/misc/tableheader.es6.js index 389a50d60b3..2debc838a3b 100644 --- a/core/misc/tableheader.es6.js +++ b/core/misc/tableheader.es6.js @@ -144,7 +144,8 @@ * * @ignore */ - 'columnschange.TableHeader drupalToolbarTrayChange': tableHeaderResizeHandler, + 'columnschange.TableHeader drupalToolbarTrayChange': + tableHeaderResizeHandler, /** * Recalculate TableHeader.topOffset when viewport is resized. diff --git a/core/modules/ckeditor/js/ckeditor.es6.js b/core/modules/ckeditor/js/ckeditor.es6.js index 698633c8e5e..fe0ebb940ff 100644 --- a/core/modules/ckeditor/js/ckeditor.es6.js +++ b/core/modules/ckeditor/js/ckeditor.es6.js @@ -257,9 +257,8 @@ : []; classes.push('ui-dialog--narrow'); dialogSettings.dialogClass = classes.join(' '); - dialogSettings.autoResize = window.matchMedia( - '(min-width: 600px)', - ).matches; + dialogSettings.autoResize = + window.matchMedia('(min-width: 600px)').matches; dialogSettings.width = 'auto'; // Add a "Loading…" message, hide it underneath the CKEditor toolbar, diff --git a/core/modules/ckeditor/js/plugins/drupalimage/plugin.es6.js b/core/modules/ckeditor/js/plugins/drupalimage/plugin.es6.js index b0258a94247..fda04cbff42 100644 --- a/core/modules/ckeditor/js/plugins/drupalimage/plugin.es6.js +++ b/core/modules/ckeditor/js/plugins/drupalimage/plugin.es6.js @@ -141,7 +141,8 @@ // CKEDITOR.style is an immutable object: we cannot modify its // definition to extend requiredContent. Hence we get the definition, // modify it, and pass it to a new CKEDITOR.style instance. - const requiredContent = widgetDefinition.requiredContent.getDefinition(); + const requiredContent = + widgetDefinition.requiredContent.getDefinition(); requiredContent.attributes['data-entity-type'] = ''; requiredContent.attributes['data-entity-uuid'] = ''; widgetDefinition.requiredContent = new CKEDITOR.style(requiredContent); @@ -156,12 +157,10 @@ // the element is already correct. We only need to update the element's // data-entity-uuid attribute. widgetDefinition.downcast = function (element) { - element.attributes['data-entity-type'] = this.data[ - 'data-entity-type' - ]; - element.attributes['data-entity-uuid'] = this.data[ - 'data-entity-uuid' - ]; + element.attributes['data-entity-type'] = + this.data['data-entity-type']; + element.attributes['data-entity-uuid'] = + this.data['data-entity-uuid']; }; // We want to upcast elements to a DOM structure required by the diff --git a/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.es6.js b/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.es6.js index 96c6f01f4a0..733e7652129 100644 --- a/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.es6.js +++ b/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.es6.js @@ -90,7 +90,8 @@ // CKEDITOR.style is an immutable object: we cannot modify its // definition to extend requiredContent. Hence we get the definition, // modify it, and pass it to a new CKEDITOR.style instance. - const requiredContent = widgetDefinition.requiredContent.getDefinition(); + const requiredContent = + widgetDefinition.requiredContent.getDefinition(); requiredContent.attributes['data-align'] = ''; requiredContent.attributes['data-caption'] = ''; widgetDefinition.requiredContent = new CKEDITOR.style( @@ -284,8 +285,8 @@ // widget.data.hasCaption as "changed" (e.g. when hasCaption === 0 // instead of hasCaption === false). This causes image2's "state // shifter" to enter the wrong branch of the algorithm and blow up. - dialogReturnValues.attributes.hasCaption = !!dialogReturnValues - .attributes.hasCaption; + dialogReturnValues.attributes.hasCaption = + !!dialogReturnValues.attributes.hasCaption; const actualWidget = saveCallback(dialogReturnValues); diff --git a/core/modules/ckeditor/js/views/ControllerView.es6.js b/core/modules/ckeditor/js/views/ControllerView.es6.js index c97a292fecd..270442ee830 100644 --- a/core/modules/ckeditor/js/views/ControllerView.es6.js +++ b/core/modules/ckeditor/js/views/ControllerView.es6.js @@ -244,9 +244,8 @@ // Get a Drupal.editorFeature object that contains all metadata for // the feature that was just added or removed. Not every feature has // such metadata. - let featureName = this.model.get('buttonsToFeatures')[ - button.toLowerCase() - ]; + let featureName = + this.model.get('buttonsToFeatures')[button.toLowerCase()]; // Features without an associated command do not have a 'feature name' by // default, so we use the lowercased button name instead. if (!featureName) { diff --git a/core/modules/editor/js/editor.admin.es6.js b/core/modules/editor/js/editor.admin.es6.js index c88b3673289..b1688ee8ff8 100644 --- a/core/modules/editor/js/editor.admin.es6.js +++ b/core/modules/editor/js/editor.admin.es6.js @@ -649,13 +649,12 @@ // If any filter's current status forbids the editor feature, return // false. Drupal.filterConfiguration.update(); - return Object.keys( - Drupal.filterConfiguration.statuses, - ).every((filterID) => - filterStatusAllowsFeature( - Drupal.filterConfiguration.statuses[filterID], - feature, - ), + return Object.keys(Drupal.filterConfiguration.statuses).every( + (filterID) => + filterStatusAllowsFeature( + Drupal.filterConfiguration.statuses[filterID], + feature, + ), ); }, }; @@ -920,24 +919,18 @@ clone.tags = this.tags.slice(0); clone.allow = this.allow; clone.restrictedTags.tags = this.restrictedTags.tags.slice(0); - clone.restrictedTags.allowed.attributes = this.restrictedTags.allowed.attributes.slice( - 0, - ); - clone.restrictedTags.allowed.styles = this.restrictedTags.allowed.styles.slice( - 0, - ); - clone.restrictedTags.allowed.classes = this.restrictedTags.allowed.classes.slice( - 0, - ); - clone.restrictedTags.forbidden.attributes = this.restrictedTags.forbidden.attributes.slice( - 0, - ); - clone.restrictedTags.forbidden.styles = this.restrictedTags.forbidden.styles.slice( - 0, - ); - clone.restrictedTags.forbidden.classes = this.restrictedTags.forbidden.classes.slice( - 0, - ); + clone.restrictedTags.allowed.attributes = + this.restrictedTags.allowed.attributes.slice(0); + clone.restrictedTags.allowed.styles = + this.restrictedTags.allowed.styles.slice(0); + clone.restrictedTags.allowed.classes = + this.restrictedTags.allowed.classes.slice(0); + clone.restrictedTags.forbidden.attributes = + this.restrictedTags.forbidden.attributes.slice(0); + clone.restrictedTags.forbidden.styles = + this.restrictedTags.forbidden.styles.slice(0); + clone.restrictedTags.forbidden.classes = + this.restrictedTags.forbidden.classes.slice(0); return clone; }; @@ -989,11 +982,10 @@ // Update current rules. if (Drupal.filterConfiguration.liveSettingParsers[filterID]) { - Drupal.filterConfiguration.statuses[ - filterID - ].rules = Drupal.filterConfiguration.liveSettingParsers[ - filterID - ].getRules(); + Drupal.filterConfiguration.statuses[filterID].rules = + Drupal.filterConfiguration.liveSettingParsers[ + filterID + ].getRules(); } }, ); @@ -1029,9 +1021,8 @@ // Create a Drupal.FilterStatus object to track the state (whether it's // active or not and its current settings, if any) of each filter. - Drupal.filterConfiguration.statuses[ - filterID - ] = new Drupal.FilterStatus(filterID); + Drupal.filterConfiguration.statuses[filterID] = + new Drupal.FilterStatus(filterID); }); }, }; diff --git a/core/modules/filter/filter.filter_html.admin.es6.js b/core/modules/filter/filter.filter_html.admin.es6.js index 3f8a4d5bae4..e4b1d31beef 100644 --- a/core/modules/filter/filter.filter_html.admin.es6.js +++ b/core/modules/filter/filter.filter_html.admin.es6.js @@ -20,9 +20,8 @@ const currentValue = $( '#edit-filters-filter-html-settings-allowed-html', ).val(); - const rules = Drupal.behaviors.filterFilterHtmlUpdating._parseSetting( - currentValue, - ); + const rules = + Drupal.behaviors.filterFilterHtmlUpdating._parseSetting(currentValue); // Build a FilterHTMLRule that reflects the hard-coded behavior that // strips all "style" attribute and all "on*" attributes. @@ -181,12 +180,10 @@ // always disallows the "style" attribute, so we only need to // support "class" attribute value restrictions. Fix once // https://www.drupal.org/node/2567801 lands. - filterRule.restrictedTags.allowed.attributes = featureRule.required.attributes.slice( - 0, - ); - filterRule.restrictedTags.allowed.classes = featureRule.required.classes.slice( - 0, - ); + filterRule.restrictedTags.allowed.attributes = + featureRule.required.attributes.slice(0); + filterRule.restrictedTags.allowed.classes = + featureRule.required.classes.slice(0); editorRequiredTags[tag] = filterRule; } // The tag is already allowed, add any additionally allowed @@ -362,9 +359,8 @@ */ Drupal.theme.filterFilterHTMLUpdateMessage = function (tags) { let html = ''; - const tagList = Drupal.behaviors.filterFilterHtmlUpdating._generateSetting( - tags, - ); + const tagList = + Drupal.behaviors.filterFilterHtmlUpdating._generateSetting(tags); html += '

'; html += Drupal.t( 'Based on the text editor configuration, these tags have automatically been added: @tag-list.', diff --git a/core/modules/layout_builder/js/layout-builder.es6.js b/core/modules/layout_builder/js/layout-builder.es6.js index 2159a2d69d2..0b4885282b5 100644 --- a/core/modules/layout_builder/js/layout-builder.es6.js +++ b/core/modules/layout_builder/js/layout-builder.es6.js @@ -324,9 +324,8 @@ const $layoutBuilderContentPreview = $('#layout-builder-content-preview'); // data-content-preview-id specifies the layout being edited. - const contentPreviewId = $layoutBuilderContentPreview.data( - 'content-preview-id', - ); + const contentPreviewId = + $layoutBuilderContentPreview.data('content-preview-id'); /** * Tracks if content preview is enabled for this layout. Defaults to true diff --git a/core/modules/quickedit/js/quickedit.es6.js b/core/modules/quickedit/js/quickedit.es6.js index 0fd0fded221..1a4f65f2a9b 100644 --- a/core/modules/quickedit/js/quickedit.es6.js +++ b/core/modules/quickedit/js/quickedit.es6.js @@ -68,8 +68,10 @@ * This document's body element. */ function initQuickEdit(bodyElement) { - Drupal.quickedit.collections.entities = new Drupal.quickedit.EntityCollection(); - Drupal.quickedit.collections.fields = new Drupal.quickedit.FieldCollection(); + Drupal.quickedit.collections.entities = + new Drupal.quickedit.EntityCollection(); + Drupal.quickedit.collections.fields = + new Drupal.quickedit.FieldCollection(); // Instantiate AppModel (application state) and AppView, which is the // controller of the whole in-place editing experience. @@ -701,9 +703,8 @@ // Clear the Quick Edit metadata cache whenever the current user's set of // permissions changes. - const permissionsHashKey = Drupal.quickedit.metadata._prefixFieldID( - 'permissionsHash', - ); + const permissionsHashKey = + Drupal.quickedit.metadata._prefixFieldID('permissionsHash'); const permissionsHashValue = storage.getItem(permissionsHashKey); const permissionsHash = drupalSettings.user.permissionsHash; if (permissionsHashValue !== permissionsHash) { diff --git a/core/modules/quickedit/js/views/EditorView.es6.js b/core/modules/quickedit/js/views/EditorView.es6.js index 21527aed0fa..e3ee331e65c 100644 --- a/core/modules/quickedit/js/views/EditorView.es6.js +++ b/core/modules/quickedit/js/views/EditorView.es6.js @@ -269,15 +269,12 @@ }; // Unsuccessfully saved; validation errors. - self.formSaveAjax.commands.quickeditFieldFormValidationErrors = function ( - ajax, - response, - status, - ) { - removeHiddenForm(); - editorModel.set('validationErrors', response.data); - fieldModel.set('state', 'invalid'); - }; + self.formSaveAjax.commands.quickeditFieldFormValidationErrors = + function (ajax, response, status) { + removeHiddenForm(); + editorModel.set('validationErrors', response.data); + fieldModel.set('state', 'invalid'); + }; // The quickeditFieldForm AJAX command is only called upon loading the // form for the first time, and when there are validation errors in the diff --git a/core/modules/quickedit/js/views/EntityToolbarView.es6.js b/core/modules/quickedit/js/views/EntityToolbarView.es6.js index d9bf8746dd1..b5152ef6960 100644 --- a/core/modules/quickedit/js/views/EntityToolbarView.es6.js +++ b/core/modules/quickedit/js/views/EntityToolbarView.es6.js @@ -258,9 +258,8 @@ case 3: // Position against a highlighted field. - highlightedField = Drupal.quickedit.app.model.get( - 'highlightedField', - ); + highlightedField = + Drupal.quickedit.app.model.get('highlightedField'); of = highlightedField && highlightedField.editorView && @@ -274,8 +273,9 @@ let topMostField = null; // Position against the topmost field. for (let i = 0; i < fieldModels.length; i++) { - const pos = fieldModels[i].get('el').getBoundingClientRect() - .top; + const pos = fieldModels[i] + .get('el') + .getBoundingClientRect().top; if (pos < topMostPosition) { topMostPosition = pos; topMostField = fieldModels[i]; @@ -496,9 +496,8 @@ const activeFieldLabel = activeField && activeField.get('metadata').label; // Label of a highlighted field, if it exists. - const highlightedField = Drupal.quickedit.app.model.get( - 'highlightedField', - ); + const highlightedField = + Drupal.quickedit.app.model.get('highlightedField'); const highlightedFieldLabel = highlightedField && highlightedField.get('metadata').label; // The label is constructed in a priority order. diff --git a/core/modules/toolbar/js/toolbar.es6.js b/core/modules/toolbar/js/toolbar.es6.js index 83ce811cdd8..09190530f3f 100644 --- a/core/modules/toolbar/js/toolbar.es6.js +++ b/core/modules/toolbar/js/toolbar.es6.js @@ -82,26 +82,23 @@ ); }); - Drupal.toolbar.views.toolbarVisualView = new Drupal.toolbar.ToolbarVisualView( - { + Drupal.toolbar.views.toolbarVisualView = + new Drupal.toolbar.ToolbarVisualView({ el: this, model, strings: options.strings, - }, - ); - Drupal.toolbar.views.toolbarAuralView = new Drupal.toolbar.ToolbarAuralView( - { + }); + Drupal.toolbar.views.toolbarAuralView = + new Drupal.toolbar.ToolbarAuralView({ el: this, model, strings: options.strings, - }, - ); - Drupal.toolbar.views.bodyVisualView = new Drupal.toolbar.BodyVisualView( - { + }); + Drupal.toolbar.views.bodyVisualView = + new Drupal.toolbar.BodyVisualView({ el: this, model, - }, - ); + }); // Force layout render to fix mobile view. Only needed on load, not // for every media query match. @@ -111,13 +108,12 @@ // Render collapsible menus. const menuModel = new Drupal.toolbar.MenuModel(); Drupal.toolbar.models.menuModel = menuModel; - Drupal.toolbar.views.menuVisualView = new Drupal.toolbar.MenuVisualView( - { + Drupal.toolbar.views.menuVisualView = + new Drupal.toolbar.MenuVisualView({ el: $(this).find('.toolbar-menu-administration').get(0), model: menuModel, strings: options.strings, - }, - ); + }); // Handle the resolution of Drupal.toolbar.setSubtrees. // This is handled with a deferred so that the function may be invoked diff --git a/core/modules/toolbar/js/views/ToolbarAuralView.es6.js b/core/modules/toolbar/js/views/ToolbarAuralView.es6.js index 76544250feb..c00e0589398 100644 --- a/core/modules/toolbar/js/views/ToolbarAuralView.es6.js +++ b/core/modules/toolbar/js/views/ToolbarAuralView.es6.js @@ -62,9 +62,8 @@ return; } const action = tray === null ? Drupal.t('closed') : Drupal.t('opened'); - const trayNameElement = relevantTray.querySelector( - '.toolbar-tray-name', - ); + const trayNameElement = + relevantTray.querySelector('.toolbar-tray-name'); let text; if (trayNameElement !== null) { text = Drupal.t('Tray "@tray" @action.', { diff --git a/core/modules/views/js/base.es6.js b/core/modules/views/js/base.es6.js index 7de476e1983..5838e64b3fe 100644 --- a/core/modules/views/js/base.es6.js +++ b/core/modules/views/js/base.es6.js @@ -30,9 +30,8 @@ pair = pairs[i].split('='); // Ignore the 'q' path argument, if present. if (pair[0] !== 'q' && pair[1]) { - args[ - decodeURIComponent(pair[0].replace(/\+/g, ' ')) - ] = decodeURIComponent(pair[1].replace(/\+/g, ' ')); + args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = + decodeURIComponent(pair[1].replace(/\+/g, ' ')); } } return args; diff --git a/core/modules/views_ui/js/views-admin.es6.js b/core/modules/views_ui/js/views-admin.es6.js index afc8aa30d71..21e98f61667 100644 --- a/core/modules/views_ui/js/views-admin.es6.js +++ b/core/modules/views_ui/js/views-admin.es6.js @@ -534,9 +534,9 @@ $description = $option.find('.description'); options[i] = { // Search on the lowercase version of the title text + description. - searchText: `${$title + searchText: `${$title.text().toLowerCase()} ${$description .text() - .toLowerCase()} ${$description.text().toLowerCase()}`, + .toLowerCase()}`, // Maintain a reference to the jQuery object for each row, so we don't // have to create a new object inside the performance-sensitive keyup // handler. diff --git a/core/tests/Drupal/Nightwatch/Tests/jsCookieTest.js b/core/tests/Drupal/Nightwatch/Tests/jsCookieTest.js index 1e90387cc85..69d4f59f617 100644 --- a/core/tests/Drupal/Nightwatch/Tests/jsCookieTest.js +++ b/core/tests/Drupal/Nightwatch/Tests/jsCookieTest.js @@ -189,53 +189,52 @@ module.exports = { }) .drupalLogAndEnd({ onlyOnError: false }); }, - 'Test jquery.cookie Shim Read all when there are cookies or return empty object': ( - browser, - ) => { - browser - .getCookie('SIMPLETEST_USER_AGENT', (simpletestCookie) => { - const simpletestCookieValue = simpletestCookie.value; - browser - .drupalRelativeURL('/js_cookie_with_shim_test') - .deleteCookies(() => { - browser - .execute(getJqueryCookie, [], (result) => { - browser.assert.deepEqual( - result.value, - {}, - '$.cookie() returns empty object', - ); - }) - .setCookie({ - name: 'js_cookie_test_first', - value: 'red panda', - }) - .setCookie({ - name: 'js_cookie_test_second', - value: 'second red panda', - }) - .setCookie({ - name: 'js_cookie_test_third', - value: 'third red panda id bad%', - }) - .execute(getJqueryCookie, [], (result) => { - browser.assert.deepEqual( - result.value, - { - js_cookie_test_first: 'red panda', - js_cookie_test_second: 'second red panda', - }, - '$.cookie() returns object containing all cookies', - ); - }) - .setCookie({ - name: 'SIMPLETEST_USER_AGENT', - value: simpletestCookieValue, - }); - }); - }) - .drupalLogAndEnd({ onlyOnError: false }); - }, + 'Test jquery.cookie Shim Read all when there are cookies or return empty object': + (browser) => { + browser + .getCookie('SIMPLETEST_USER_AGENT', (simpletestCookie) => { + const simpletestCookieValue = simpletestCookie.value; + browser + .drupalRelativeURL('/js_cookie_with_shim_test') + .deleteCookies(() => { + browser + .execute(getJqueryCookie, [], (result) => { + browser.assert.deepEqual( + result.value, + {}, + '$.cookie() returns empty object', + ); + }) + .setCookie({ + name: 'js_cookie_test_first', + value: 'red panda', + }) + .setCookie({ + name: 'js_cookie_test_second', + value: 'second red panda', + }) + .setCookie({ + name: 'js_cookie_test_third', + value: 'third red panda id bad%', + }) + .execute(getJqueryCookie, [], (result) => { + browser.assert.deepEqual( + result.value, + { + js_cookie_test_first: 'red panda', + js_cookie_test_second: 'second red panda', + }, + '$.cookie() returns object containing all cookies', + ); + }) + .setCookie({ + name: 'SIMPLETEST_USER_AGENT', + value: simpletestCookieValue, + }); + }); + }) + .drupalLogAndEnd({ onlyOnError: false }); + }, 'Test jquery.cookie Shim $.cookie deprecation message': (browser) => { browser .drupalRelativeURL('/js_cookie_with_shim_test')