From 693f9e4e28704577e93d3200bc4d8fdc80d32047 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Thu, 18 Oct 2018 22:53:06 +0100 Subject: [PATCH] Make toggleAttribute match with native signature (#5372) --- lib/legacy/legacy-element-mixin.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/legacy/legacy-element-mixin.js b/lib/legacy/legacy-element-mixin.js index 151a13fa56..a6d00c1671 100644 --- a/lib/legacy/legacy-element-mixin.js +++ b/lib/legacy/legacy-element-mixin.js @@ -816,11 +816,13 @@ export const LegacyElementMixin = dedupingMixin((base) => { * @param {string} name HTML attribute name * @param {boolean=} bool Boolean to force the attribute on or off. * When unspecified, the state of the attribute will be reversed. - * @param {Element=} node Node to target. Defaults to `this`. * @return {boolean} true if the attribute now exists */ - toggleAttribute(name, bool, node) { - node = /** @type {Element} */ (node || this); + toggleAttribute(name, bool) { + let node = /** @type {Element} */ this; + if (arguments.length === 3) { + node = /** @type {Element} */ arguments[2]; + } if (arguments.length == 1) { bool = !node.hasAttribute(name); }