diff options
Diffstat (limited to 'src/js/controls.js')
-rw-r--r-- | src/js/controls.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/js/controls.js b/src/js/controls.js index ac7ba2b6..4f6ef365 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -73,7 +73,16 @@ const controls = { // Create the <use> to reference sprite const use = document.createElementNS(namespace, 'use'); - use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', `${iconPath}-${type}`); + const path = `${iconPath}-${type}`; + + // If the new `href` attribute is supported, use that + // https://github.com/sampotts/plyr/issues/460 + // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href + if ('href' in use) { + use.setAttribute('href', path); + } else { + use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path); + } // Add <use> to <svg> icon.appendChild(use); |