Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
fix: use toggleAttribute for boolean attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
luwes committed Apr 1, 2023
1 parent 9379526 commit e5b7a04
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions vimeo-video-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,7 @@ class VimeoVideoElement extends HTMLElement {

set autoplay(val) {
if (this.autoplay == val) return;
if (val) this.setAttribute('autoplay', '');
else this.removeAttribute('autoplay');
this.toggleAttribute('autoplay', Boolean(val));
}

get buffered() {
Expand All @@ -340,8 +339,7 @@ class VimeoVideoElement extends HTMLElement {

set controls(val) {
if (this.controls == val) return;
if (val) this.setAttribute('controls', '');
else this.removeAttribute('controls');
this.toggleAttribute('controls', Boolean(val));
}

get currentTime() {
Expand All @@ -362,8 +360,7 @@ class VimeoVideoElement extends HTMLElement {

set defaultMuted(val) {
if (this.defaultMuted == val) return;
if (val) this.setAttribute('muted', '');
else this.removeAttribute('muted');
this.toggleAttribute('muted', Boolean(val));
}

get loop() {
Expand All @@ -372,8 +369,7 @@ class VimeoVideoElement extends HTMLElement {

set loop(val) {
if (this.loop == val) return;
if (val) this.setAttribute('loop', '');
else this.removeAttribute('loop');
this.toggleAttribute('loop', Boolean(val));
}

get muted() {
Expand Down Expand Up @@ -406,8 +402,7 @@ class VimeoVideoElement extends HTMLElement {

set playsInline(val) {
if (this.playsInline == val) return;
if (val) this.setAttribute('playsinline', '');
else this.removeAttribute('playsinline');
this.toggleAttribute('playsinline', Boolean(val));
}

get poster() {
Expand Down

1 comment on commit e5b7a04

@vercel
Copy link

@vercel vercel bot commented on e5b7a04 Apr 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vimeo-video-element – ./

vimeo-video-element-git-main-luwes.vercel.app
vimeo-video-element-luwes.vercel.app
vimeo-video-element.vercel.app

Please sign in to comment.