diff --git a/core/.eslintrc.passing.json b/core/.eslintrc.passing.json index 52bbfc7e42da27118d999bbbacc54db5a7dc8cd7..449ec7030895d3d66f8400d15ad4e1637982ecc2 100644 --- a/core/.eslintrc.passing.json +++ b/core/.eslintrc.passing.json @@ -9,7 +9,6 @@ "default-case": "off", "prefer-destructuring": "off", "operator-linebreak": "off", - "no-restricted-globals": "off", "react/no-this-in-sfc": "off", "react/destructuring-assignment": "off", "implicit-arrow-linebreak": "off", diff --git a/core/misc/collapse.es6.js b/core/misc/collapse.es6.js index 374af0c1c9aa22df5e142c8d88a00587007c6d96..b97c3e4d7ccb132764cddc3615dfe15499422fd3 100644 --- a/core/misc/collapse.es6.js +++ b/core/misc/collapse.es6.js @@ -17,7 +17,7 @@ this.$node.data('details', this); // Expand details if there are errors inside, or if it contains an // element that is targeted by the URI fragment identifier. - const anchor = location.hash && location.hash !== '#' ? `, ${location.hash}` : ''; + const anchor = window.location.hash && window.location.hash !== '#' ? `, ${window.location.hash}` : ''; if (this.$node.find(`.error${anchor}`).length) { this.$node.attr('open', true); } diff --git a/core/misc/collapse.js b/core/misc/collapse.js index 2f157bad31e70c8f287d225da44164f6a4a9d4e2..3c09ab18b77e6e29d7a7621180f8fbc3ffaabec8 100644 --- a/core/misc/collapse.js +++ b/core/misc/collapse.js @@ -10,7 +10,7 @@ this.$node = $(node); this.$node.data('details', this); - var anchor = location.hash && location.hash !== '#' ? ', ' + location.hash : ''; + var anchor = window.location.hash && window.location.hash !== '#' ? ', ' + window.location.hash : ''; if (this.$node.find('.error' + anchor).length) { this.$node.attr('open', true); } diff --git a/core/misc/displace.es6.js b/core/misc/displace.es6.js index 4a87edc3d12245746a8c3d75c01c5a164b781d3e..168b5eb336c48a5dbc8ea97eff982950a1a02e86 100644 --- a/core/misc/displace.es6.js +++ b/core/misc/displace.es6.js @@ -122,6 +122,7 @@ // If the element's offset data attribute exits // but is not a valid number then get the displacement // dimensions directly from the element. + // eslint-disable-next-line no-restricted-globals if (isNaN(displacement)) { displacement = getRawOffset(el, edge); } diff --git a/core/misc/drupal.es6.js b/core/misc/drupal.es6.js index 546527a34c6bf90dc09e17ae53a47d95afeaa916..260a7d7248593effb2b039db7939c658267e6915 100644 --- a/core/misc/drupal.es6.js +++ b/core/misc/drupal.es6.js @@ -434,14 +434,14 @@ window.Drupal = { behaviors: {}, locale: {} }; // 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); - let protocol = location.protocol; + let { protocol } = window.location; // Consider URLs that match this site's base URL but use HTTPS instead of HTTP // as local as well. if (protocol === 'http:' && absoluteUrl.indexOf('https:') === 0) { protocol = 'https:'; } - let baseUrl = `${protocol}//${location.host}${drupalSettings.path.baseUrl.slice(0, -1)}`; + let baseUrl = `${protocol}//${window.location.host}${drupalSettings.path.baseUrl.slice(0, -1)}`; // Decoding non-UTF-8 strings may throw an exception. try { diff --git a/core/misc/drupal.js b/core/misc/drupal.js index 39a74e4f51863ef988be9b8bc987ae4b4798aa6a..4e3389358e14ddc3acc33c4220ad0cb1e80b9639 100644 --- a/core/misc/drupal.js +++ b/core/misc/drupal.js @@ -135,12 +135,12 @@ window.Drupal = { behaviors: {}, locale: {} }; 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:'; } - 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); diff --git a/core/misc/form.es6.js b/core/misc/form.es6.js index 47674a556a0fef021182223e483de2c67afbb6b5..9afc7a11adc5441897078eaa822e0c290ade6933 100644 --- a/core/misc/form.es6.js +++ b/core/misc/form.es6.js @@ -270,7 +270,7 @@ url = e.currentTarget.location ? e.currentTarget.location : e.currentTarget; } else { - url = location; + url = window.location; } const hash = url.hash.substr(1); if (hash) { diff --git a/core/misc/form.js b/core/misc/form.js index baaba184ee228081a0bef71dae82553b4f4118e8..88226a51569815ddb5a32f73a0043a0acaae9c90 100644 --- a/core/misc/form.js +++ b/core/misc/form.js @@ -130,7 +130,7 @@ if (e.type === 'click') { url = e.currentTarget.location ? e.currentTarget.location : e.currentTarget; } else { - url = location; + url = window.location; } var hash = url.hash.substr(1); if (hash) { diff --git a/core/modules/ckeditor/js/ckeditor.es6.js b/core/modules/ckeditor/js/ckeditor.es6.js index a6429e0b5ecf813214468552a51f954f2c1f2a0a..c4ba1567398cb0eea3a3f3246492d878d2eae555 100644 --- a/core/modules/ckeditor/js/ckeditor.es6.js +++ b/core/modules/ckeditor/js/ckeditor.es6.js @@ -295,13 +295,13 @@ // Redirect on hash change when the original hash has an associated CKEditor. function redirectTextareaFragmentToCKEditorInstance() { - const hash = location.hash.substr(1); + const hash = window.location.hash.substr(1); const element = document.getElementById(hash); if (element) { const editor = CKEDITOR.dom.element.get(element).getEditor(); if (editor) { const id = editor.container.getAttribute('id'); - location.replace(`#${id}`); + window.location.replace(`#${id}`); } } } diff --git a/core/modules/ckeditor/js/ckeditor.js b/core/modules/ckeditor/js/ckeditor.js index becf7a19e791706fff19cb05e6d2fa5eb100ba88..9a6445044962ad4f765f35147285d208f62cabee 100644 --- a/core/modules/ckeditor/js/ckeditor.js +++ b/core/modules/ckeditor/js/ckeditor.js @@ -177,13 +177,13 @@ }); function redirectTextareaFragmentToCKEditorInstance() { - var hash = location.hash.substr(1); + var hash = window.location.hash.substr(1); var element = document.getElementById(hash); if (element) { var editor = CKEDITOR.dom.element.get(element).getEditor(); if (editor) { var id = editor.container.getAttribute('id'); - location.replace('#' + id); + window.location.replace('#' + id); } } } diff --git a/core/modules/menu_ui/menu_ui.admin.es6.js b/core/modules/menu_ui/menu_ui.admin.es6.js index 3144d13dc1b33788ae60aefdf1df786fa55fb794..7a8d7d17bd360795f001b477e1ca2479651cca5d 100644 --- a/core/modules/menu_ui/menu_ui.admin.es6.js +++ b/core/modules/menu_ui/menu_ui.admin.es6.js @@ -35,7 +35,7 @@ }); $.ajax({ - url: `${location.protocol}//${location.host}${Drupal.url('admin/structure/menu/parents')}`, + url: `${window.location.protocol}//${window.location.host}${Drupal.url('admin/structure/menu/parents')}`, type: 'POST', data: { 'menus[]': values }, dataType: 'json', diff --git a/core/modules/menu_ui/menu_ui.admin.js b/core/modules/menu_ui/menu_ui.admin.js index 03e0e22ae73d5186781143861d7f002ce838b06e..0f0e882c9809ba3a069a9822241298c394aabbe7 100644 --- a/core/modules/menu_ui/menu_ui.admin.js +++ b/core/modules/menu_ui/menu_ui.admin.js @@ -26,7 +26,7 @@ }); $.ajax({ - url: location.protocol + '//' + location.host + Drupal.url('admin/structure/menu/parents'), + url: window.location.protocol + '//' + window.location.host + Drupal.url('admin/structure/menu/parents'), type: 'POST', data: { 'menus[]': values }, dataType: 'json', diff --git a/core/modules/quickedit/js/views/AppView.es6.js b/core/modules/quickedit/js/views/AppView.es6.js index fed6396c0e30238476e13c8a426168e84657075f..426dab0cd05512f6594c0a053a40078d0f04437d 100644 --- a/core/modules/quickedit/js/views/AppView.es6.js +++ b/core/modules/quickedit/js/views/AppView.es6.js @@ -103,7 +103,7 @@ // the edited fields. if (reload) { reload = false; - location.reload(); + window.location.reload(); } break; } diff --git a/core/modules/quickedit/js/views/AppView.js b/core/modules/quickedit/js/views/AppView.js index 51c80f1556dffd1e6cc096249c6a80b2b8fdbfdd..b0fa275d919728effda66f90ae2da48bb7f7a26b 100644 --- a/core/modules/quickedit/js/views/AppView.js +++ b/core/modules/quickedit/js/views/AppView.js @@ -63,7 +63,7 @@ if (reload) { reload = false; - location.reload(); + window.location.reload(); } break; } diff --git a/core/modules/toolbar/js/toolbar.menu.es6.js b/core/modules/toolbar/js/toolbar.menu.es6.js index 6fe8ede0161792850ecfe23bdfb07110a3a07c31..78660c5a34f2017a46434ac7482db34fa8a1ac30 100644 --- a/core/modules/toolbar/js/toolbar.menu.es6.js +++ b/core/modules/toolbar/js/toolbar.menu.es6.js @@ -142,9 +142,9 @@ * The root of the menu. */ function openActiveItem($menu) { - const pathItem = $menu.find(`a[href="${location.pathname}"]`); + const pathItem = $menu.find(`a[href="${window.location.pathname}"]`); if (pathItem.length && !activeItem) { - activeItem = location.pathname; + activeItem = window.location.pathname; } if (activeItem) { const $activeItem = $menu.find(`a[href="${activeItem}"]`).addClass('menu-item--active'); diff --git a/core/modules/toolbar/js/toolbar.menu.js b/core/modules/toolbar/js/toolbar.menu.js index b0706390b77b7dd9324bac65ab6b0fa313bfdf9b..5d533dff5623ee5b5cf1e3e0b2c182d5b64c45ef 100644 --- a/core/modules/toolbar/js/toolbar.menu.js +++ b/core/modules/toolbar/js/toolbar.menu.js @@ -72,9 +72,9 @@ } function openActiveItem($menu) { - var pathItem = $menu.find('a[href="' + location.pathname + '"]'); + var pathItem = $menu.find('a[href="' + window.location.pathname + '"]'); if (pathItem.length && !activeItem) { - activeItem = location.pathname; + activeItem = window.location.pathname; } if (activeItem) { var $activeItem = $menu.find('a[href="' + activeItem + '"]').addClass('menu-item--active');