Runtime error when setting innerHTML in IE8

When I use plupload, I was puzzled by an exception.
It’s simple.
I reproduce it with the critical code.
HTML:

<p id="container"></p>

Javascript:

var a = document.createElement('div');
document.getElementById('container').appendChild(a);
a.innerHTML="222";

In IE8,It throws runtime exception.

I found some same situations, just like to modify a element triggered by itself, but this one seems unreasonable.

Finally, I found out why: the html content models, Each element defined in this specification has a content model: a description of the element’s expected contents. An HTML element must have contents that match the requirements described in the element’s content model.

The link of description http://www.w3.org/TR/2011/WD-html5-20110525/content-models.html

And The content models http://www.w3.org/TR/html-markup/common-models.html

I thought IE has more powerful fault tolerant, may be sometimes.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.