aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/utils.js')
-rw-r--r--src/js/utils.js7
1 files changed, 7 insertions, 0 deletions
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));