The MDN documentation for Node.textContent reads:
Both textContent and innerText remove child nodes when altered, but altering innerText in Internet Explorer (version 11 and below) also permanently destroys all descendant text nodes. It is impossible to insert the nodes again into any other element or into the same element after doing so.
In IE, what was the purpose of destroying all descendant text nodes when the innerText is altered?
CodePudding user response:
After searching a lot, I only find this explanation which makes sense. It talks about innerHTML
, but I think innerText
is the same: In IE, innerText
is a DHTML (not DOM) characteristic and also a low-level destructive method.
After all, IE uses different JavaScript engine than other browsers. So the implementation will also be different.
Reference link: Why does IE discard the innerHTML/children of a DOM element after DOM changes?