aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/utils.js
diff options
context:
space:
mode:
authorSam Potts <me@sampotts.me>2017-11-09 19:40:45 +1100
committerSam Potts <me@sampotts.me>2017-11-09 19:40:45 +1100
commitf878581c8fe8c3e525722762553cf085e67d990f (patch)
tree600a9b488be0017740e31b089fad96130fddc8a4 /src/js/utils.js
parent86a5724bdb84a1dc9e503f5907ad80caf395bf0a (diff)
downloadplyr-f878581c8fe8c3e525722762553cf085e67d990f.tar.lz
plyr-f878581c8fe8c3e525722762553cf085e67d990f.tar.xz
plyr-f878581c8fe8c3e525722762553cf085e67d990f.zip
UI bugs
Diffstat (limited to 'src/js/utils.js')
-rw-r--r--src/js/utils.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/js/utils.js b/src/js/utils.js
index 02f97d5a..1c78766f 100644
--- a/src/js/utils.js
+++ b/src/js/utils.js
@@ -536,19 +536,17 @@ const utils = {
// Toggle aria-pressed state on a toggle button
// http://www.ssbbartgroup.com/blog/how-not-to-misuse-aria-states-properties-and-roles
- toggleState(target, state) {
+ toggleState(element, input) {
// Bail if no target
- if (!target) {
- return null;
+ if (!utils.is.htmlElement(element)) {
+ return;
}
// Get state
- const newState = utils.is.boolean(state) ? state : !target.getAttribute('aria-pressed');
+ const state = utils.is.boolean(input) ? input : !element.getAttribute('aria-pressed');
// Set the attribute on target
- target.setAttribute('aria-pressed', newState);
-
- return newState;
+ element.setAttribute('aria-pressed', state);
},
// Get percentage