I'm trying to figure out how browsers do the DOM
update job when javascript changes the Node.innerHTML
property.
Given the code:
> var obj=document.createElement("DIV");
> obj.innerHTML='<P><SPAN>A</SPAN></P><DIV>B</DIV>';
> obj.childNodes
[<p><span>A</span></p>, <div>B</div>]
It seems to be magic for me, since I think that innerHTML is a property, not a function, so...
How javascript can be notified of changes in a field to call a function to update the DOM tree ?
Is There any type of listener for call a function when a variable is changed in javascript, or only some daemon monitor Node.innerHTML variables on each javascript line executed ?
If you wonder why it matter, I'm writing a DOMParser and this is a issue for me.
Using the given references, I understood that browser engine may provide ways like Object.watch (gecko) or Object.observe(chrome).
But there is a way to do it in nodejs ?