From b12eeb0eb7b59671bb887770fc787940e4659a21 Mon Sep 17 00:00:00 2001 From: Albin Larsson Date: Mon, 4 Jun 2018 14:22:09 +0200 Subject: Merge captions setText and setCue into updateCues (fixes #998 and vimeo cuechange event) --- src/js/utils.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/js/utils.js') diff --git a/src/js/utils.js b/src/js/utils.js index b6ba0941..a152e121 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -833,6 +833,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)); -- cgit v1.2.3