Skip to content

Commit

Permalink
Make toggleAttribute match with native signature (#5372)
Browse files Browse the repository at this point in the history
  • Loading branch information
43081j authored and TimvdLippe committed Oct 18, 2018
1 parent 750e7e1 commit 693f9e4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/legacy/legacy-element-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 693f9e4

Please sign in to comment.