Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make toggleAttribute match with native signature #5372

Merged
merged 1 commit into from
Oct 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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