Beautiful Bytecodes · Aug 6, 2014
A faster way to replace an element's contents in a web page
0Sign in to vote or save
This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.
The other day I was writing a web user interface in Javascript to view a dataset and I discovered that some calls to set innerHTML on a div element were taking over a minute (in Chrome). This line was the culprit: someDiv . innerHTML = newHTML ; Looks innocuous right? I dug a little deeper and discovered that the slow calls were only when the existing html in the div was large (~6M characters).…
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.