dfilatov / vidom

Library to build UI based on virtual DOM
MIT License
415 stars 16 forks source link

Optimize updating of text nodes #192

Closed dfilatov closed 8 years ago

dfilatov commented 8 years ago

Currently textContent property is always used in corresponding patch operation to update text. In case of update previous text node, nodeValue property can be used to increase performance.

const firstChild = domNode.firstChild;
if(firstChild) {
    firstChild.nodeValue = newText;
}
else {
    domNode.textContent = newText;
}