diff options
author | Sam Potts <sam@potts.es> | 2018-10-24 22:39:10 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-24 22:39:10 +1100 |
commit | b6175b1ca903640cb44f62e29cc10d77fc3655be (patch) | |
tree | 6ce4fec55e18f09024f210f6a4c8cc1418b6aa11 /src/js/controls.js | |
parent | a86bbae85145a22d0ed7f259fe86fe82b86dd7ff (diff) | |
parent | aa20ebaa9c38363c0d1720bbb6c3c37eef630393 (diff) | |
download | plyr-b6175b1ca903640cb44f62e29cc10d77fc3655be.tar.lz plyr-b6175b1ca903640cb44f62e29cc10d77fc3655be.tar.xz plyr-b6175b1ca903640cb44f62e29cc10d77fc3655be.zip |
Merge branch 'develop' into fix-html5-quality-settings
Diffstat (limited to 'src/js/controls.js')
-rw-r--r-- | src/js/controls.js | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/js/controls.js b/src/js/controls.js index 785f100d..4f453e6a 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -111,10 +111,11 @@ const controls = { // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href if ('href' in use) { use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path); - } else { - use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path); } + // Always set the older attribute even though it's "deprecated" (it'll be around for ages) + use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path); + // Add <use> to <svg> icon.appendChild(use); @@ -1228,11 +1229,15 @@ const controls = { // Set the download link setDownloadLink() { - // Set download link - const { download } = this.elements.buttons; - if (is.element(download)) { - download.setAttribute('href', this.source); + const button = this.elements.buttons.download; + + // Bail if no button + if (!is.element(button)) { + return; } + + // Set download link + button.setAttribute('href', this.download); }, // Build the default HTML @@ -1515,15 +1520,13 @@ const controls = { if (this.config.controls.includes('download')) { const attributes = { element: 'a', - href: this.source, + href: this.download, target: '_blank', }; - if (this.isHTML5) { - extend(attributes, { - download: '', - }); - } else if (this.isEmbed) { + const { download } = this.config.urls; + + if (!is.url(download) && this.isEmbed) { extend(attributes, { icon: `logo-${this.provider}`, label: this.provider, |