Skip to content

Commit 693f9e4

Browse files
43081jTimvdLippe
authored andcommitted
Make toggleAttribute match with native signature (#5372)
1 parent 750e7e1 commit 693f9e4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/legacy/legacy-element-mixin.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -816,11 +816,13 @@ export const LegacyElementMixin = dedupingMixin((base) => {
816816
* @param {string} name HTML attribute name
817817
* @param {boolean=} bool Boolean to force the attribute on or off.
818818
* When unspecified, the state of the attribute will be reversed.
819-
* @param {Element=} node Node to target. Defaults to `this`.
820819
* @return {boolean} true if the attribute now exists
821820
*/
822-
toggleAttribute(name, bool, node) {
823-
node = /** @type {Element} */ (node || this);
821+
toggleAttribute(name, bool) {
822+
let node = /** @type {Element} */ this;
823+
if (arguments.length === 3) {
824+
node = /** @type {Element} */ arguments[2];
825+
}
824826
if (arguments.length == 1) {
825827
bool = !node.hasAttribute(name);
826828
}

0 commit comments

Comments
 (0)