You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operations using me, my and I after append operations on parent silently fails.
Looks like append operation is using += operation on innerHTML, which makes entire innerHTML parsed again and Element that existed before gets replaced with new Element and causing the problem.
innerHTML gets parsed once again and replaced with new Element
me points to Element that no longer exists
IMO, For performance reason append should not use target.innerHTML += ... but use Element.append() so that this problem will not happen and browser don't have to parse all elements once again:
letnewElementString='<div>Hello World</div>';target.innerHTML+=newElementString;// This causes performance issue and already existing Elements gets replaced with new ElementletnewElement=document.createElement('div');newElement.outerHTML=newElementString;target.append(newElement);// This "appends" the element, browser only have to parse new element and this issue solves too
Operations using
me
,my
andI
afterappend
operations on parent silently fails.Looks like
append
operation is using+=
operation oninnerHTML
, which makes entire innerHTML parsed again andElement
that existed before gets replaced with newElement
and causing the problem._hyperscript/src/_hyperscript.js
Line 5849 in 898345a
Simplified explanation:
Element
(me
)Element
me
points toElement
that no longer existsIMO, For performance reason
append
should not usetarget.innerHTML += ...
but useElement.append()
so that this problem will not happen and browser don't have to parse all elements once again:Examples:
Works:
Does not work:
The text was updated successfully, but these errors were encountered: