Handle no audio, more docs in code, fix for playing getter

This commit is contained in:
Sam Potts
2017-11-21 20:14:57 +11:00
parent f33bc5a5c6
commit d3b31e595a
12 changed files with 209 additions and 66 deletions

View File

@ -118,7 +118,7 @@ const utils = {
if (!hasId || !document.querySelectorAll(`#${id}`).length) {
// Create container
const container = document.createElement('div');
container.setAttribute('hidden', '');
utils.toggleHidden(container, true);
if (hasId) {
container.setAttribute('id', id);
@ -337,6 +337,19 @@ const utils = {
return utils.is.htmlElement(element) && element.classList.contains(className);
},
// Toggle hidden attribute on an element
toggleHidden(element, toggle) {
if (!utils.is.htmlElement(element)) {
return;
}
if (toggle) {
element.setAttribute('hidden', '');
} else {
element.removeAttribute('hidden');
}
},
// Element matches selector
matches(element, selector) {
const prototype = { Element };