34
loading...
This website collects cookies to deliver better user experience
Plug: I help develop million
: <1kb virtual DOM - it's fast!
innerHTML
property on an element. For example, if I want to add a div
element in the document body, I could do something like this:document.body.innerHTML = '<div>Hello World!</div>';
// <body> now has a <div>Hello World!</div> child.
innerHTML
needs to parse DOM nodes from a string, preprocess, and append it, resulting in less-than-optimal performance. The issues with performance are increasingly noticable when there are more children/attributes and when the interval of mutation is shorter.innerHTML
solution.const div = document.createElement('div');
div.textContent = 'Hello World!';
document.body.appendChild(div);
innerHTML
example) while harnessing performance by making only pinpoint changes to the DOM.O(n^3)
time complexity, meaning the more children, the longer the time it will take to perform the action. To solve this, Million was created.textContent
of elements to boost performance.