2.5.15
Your "title" should change back to what was set by your method.
Title can't be changed anymore by your method. Vue is losing the binding to the element after it's updated via $refs.
This happens only on Firefox (I'm using 60.0b2), other browsers (chrome, chromium) are fine.
This is because when you set innerText, it throws aways the current TextNodes inside the element and creates new ones. However, Vue is still holding on to the TextNodes for subsequent updates.
Note it's not recommended to mutate nodes via refs unless you absolutely need to. That said, to change the text without replacing the text nodes, use
vm1.$refs.heading.childNodes[0].data = 'Something else';
But why then it happens only in Firefox and not in Chrome?
Most helpful comment
This is because when you set
innerText, it throws aways the current TextNodes inside the element and creates new ones. However, Vue is still holding on to the TextNodes for subsequent updates.Note it's not recommended to mutate nodes via
refsunless you absolutely need to. That said, to change the text without replacing the text nodes, use