From e0f2520fb03ed07a38e96c012c0f599b2fbe7f04 Mon Sep 17 00:00:00 2001 From: RblSb Date: Sun, 26 Apr 2020 06:14:07 +0300 Subject: Fix autoscroll with unloaded images --- src/client/Utils.hx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/client/Utils.hx') diff --git a/src/client/Utils.hx b/src/client/Utils.hx index 3ac9953..e9d5ff8 100644 --- a/src/client/Utils.hx +++ b/src/client/Utils.hx @@ -10,6 +10,12 @@ class Utils { return js.Syntax.code("'ontouchstart' in window"); } + public static function nodeFromString(div:String):Element { + final wrapper = document.createDivElement(); + wrapper.innerHTML = div; + return wrapper.firstElementChild; + } + public static function prepend(parent:Element, child:Element):Void { if (parent.firstChild == null) parent.appendChild(child); else parent.insertBefore(child, parent.firstChild); -- cgit v1.2.3