choojs/nanohtml

<textarea> doesnt always morph

Closed this issue · 1 comments

shama commented

Consider this example:

function textarea (value) {
  return yo`<textarea>${value}</textarea>`
}
var el = textarea('foo')
yo.update(el, textarea('bar'))

foo will still be displayed in the textarea. This is because morphdom compares el.value of textarea nodes and bel sets it by appendChild(document.createTextNode()). The browser takes a little bit to compute the textContent into a value, so if you update immediately after, morphdom doesn't get the new el.value.