From ce85eb99c748f61b6a2ceac5b913fc358ea8f6c0 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Mon, 8 Oct 2018 12:16:57 +0100 Subject: [PATCH] Fix signature of toggleAttribute to match native version (#5370) * implement native toggleAttribute signature * jsdoc for legacy return type --- lib/legacy/legacy-element-mixin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/legacy/legacy-element-mixin.js b/lib/legacy/legacy-element-mixin.js index c041f72d54..151a13fa56 100644 --- a/lib/legacy/legacy-element-mixin.js +++ b/lib/legacy/legacy-element-mixin.js @@ -817,7 +817,7 @@ export const LegacyElementMixin = dedupingMixin((base) => { * @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 {void} + * @return {boolean} true if the attribute now exists */ toggleAttribute(name, bool, node) { node = /** @type {Element} */ (node || this); @@ -826,8 +826,10 @@ export const LegacyElementMixin = dedupingMixin((base) => { } if (bool) { node.setAttribute(name, ''); + return true; } else { node.removeAttribute(name); + return false; } }