From e2c7491ccdbc09055d578d2631d92e892359bad4 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Tue, 7 Nov 2017 09:58:37 +1100 Subject: =?UTF-8?q?Using=20the=20=E2=80=9Chref=E2=80=9D=20attribute=20on?= =?UTF-8?q?=20SVG=20if=20supported,=20using=20hasAttribute?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/controls.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/js/controls.js') 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 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 to icon.appendChild(use); -- cgit v1.2.3 From 966ca1acc30d87e1b821d78cfddc35ca75557eff Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Tue, 7 Nov 2017 18:01:24 +1100 Subject: Trap focus fix --- src/js/controls.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index 4f6ef365..0759492b 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -1134,8 +1134,7 @@ const controls = { // Larger overlaid play button if (this.config.controls.includes('play-large')) { - this.elements.buttons.playLarge = controls.createButton.call(this, 'play-large'); - this.elements.container.appendChild(this.elements.buttons.playLarge); + this.elements.container.appendChild(controls.createButton.call(this, 'play-large')); } this.elements.controls = container; -- cgit v1.2.3