Skip to content
Snippets Groups Projects
Commit cf52b419 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2915534 by drpal, nod_: JS codestyle: prefer-rest-params

parent 969cafbf
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
"new-cap": "off", "new-cap": "off",
"max-len": "off", "max-len": "off",
"default-case": "off", "default-case": "off",
"camelcase": "off", "camelcase": "off"
"prefer-rest-params": "off"
} }
} }
...@@ -29,9 +29,8 @@ ...@@ -29,9 +29,8 @@
Drupal.debounce = function (func, wait, immediate) { Drupal.debounce = function (func, wait, immediate) {
let timeout; let timeout;
let result; let result;
return function () { return function (...args) {
const context = this; const context = this;
const args = arguments;
const later = function () { const later = function () {
timeout = null; timeout = null;
if (!immediate) { if (!immediate) {
......
...@@ -9,8 +9,11 @@ Drupal.debounce = function (func, wait, immediate) { ...@@ -9,8 +9,11 @@ Drupal.debounce = function (func, wait, immediate) {
var timeout = void 0; var timeout = void 0;
var result = void 0; var result = void 0;
return function () { return function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var context = this; var context = this;
var args = arguments;
var later = function later() { var later = function later() {
timeout = null; timeout = null;
if (!immediate) { if (!immediate) {
......
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
const originalClose = settings.dialog.close; const originalClose = settings.dialog.close;
// Overwrite the close method to remove the dialog on closing. // Overwrite the close method to remove the dialog on closing.
settings.dialog.close = function (event) { settings.dialog.close = function (event, ...args) {
originalClose.apply(settings.dialog, arguments); originalClose.apply(settings.dialog, [event, ...args]);
$(event.target).remove(); $(event.target).remove();
}; };
}, },
......
...@@ -26,7 +26,11 @@ ...@@ -26,7 +26,11 @@
var originalClose = settings.dialog.close; var originalClose = settings.dialog.close;
settings.dialog.close = function (event) { settings.dialog.close = function (event) {
originalClose.apply(settings.dialog, arguments); for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
originalClose.apply(settings.dialog, [event].concat(args));
$(event.target).remove(); $(event.target).remove();
}; };
}, },
......
...@@ -559,10 +559,9 @@ window.Drupal = { behaviors: {}, locale: {} }; ...@@ -559,10 +559,9 @@ window.Drupal = { behaviors: {}, locale: {} };
* Any data the theme function returns. This could be a plain HTML string, * Any data the theme function returns. This could be a plain HTML string,
* but also a complex object. * but also a complex object.
*/ */
Drupal.theme = function (func) { Drupal.theme = function (func, ...args) {
const args = Array.prototype.slice.apply(arguments, [1]);
if (func in Drupal.theme) { if (func in Drupal.theme) {
return Drupal.theme[func].apply(this, args); return Drupal.theme[func](...args);
} }
}; };
......
...@@ -181,9 +181,14 @@ window.Drupal = { behaviors: {}, locale: {} }; ...@@ -181,9 +181,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);
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment