diff options
author | Sam Potts <sam@potts.es> | 2018-06-11 13:21:05 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-11 13:21:05 +1000 |
commit | 7d26f41d646d37e52fa774c99c603aa0663c51d4 (patch) | |
tree | 40a352afc6088130aad907f2f5e3bdb54deb46b4 /src/js/utils.js | |
parent | f37f465ce452f33a0b1b06f2fd07ed014906b715 (diff) | |
parent | 41012a9843558f67bac7969ffe5bf7161a10893c (diff) | |
download | plyr-7d26f41d646d37e52fa774c99c603aa0663c51d4.tar.lz plyr-7d26f41d646d37e52fa774c99c603aa0663c51d4.tar.xz plyr-7d26f41d646d37e52fa774c99c603aa0663c51d4.zip |
Merge pull request #1015 from friday/captions-fixes-again
Captions rewrite (use index internally to support missing or duplicate languages)
Diffstat (limited to 'src/js/utils.js')
-rw-r--r-- | src/js/utils.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/js/utils.js b/src/js/utils.js index a7d2ada4..109de031 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -831,6 +831,13 @@ const utils = { return fragment.firstChild.innerText; }, + // Like outerHTML, but also works for DocumentFragment + getHTML(element) { + const wrapper = document.createElement('div'); + wrapper.appendChild(element); + return wrapper.innerHTML; + }, + // Get aspect ratio for dimensions getAspectRatio(width, height) { const getRatio = (w, h) => (h === 0 ? w : getRatio(h, w % h)); |