Say you have an iframe and you are modifying its contentDocument with javascript.
Theoretically you can do this by either setting the contentDocument.body.innerHTML
directly or using contentDocument.write()
In chrome both work just fine. In firefox however the top one flashes in and out. (In IE10 the top one throws an error with the body being null but I'm not worried about IE).
Two questions:
In Firefox, when you create an iframe it starts loading about:blank
. Then your script races with that load: you modify the DOM, and then about:blank loads and wipes out your changes.
"The spec" doesn't define the behavior here so far (like most of document loading), though there's a proposal in webapps that would do so. That proposal would be that there should be no about:blank load in this situation and instead a fake load event should get fired even though no load happened (because websites depend on frames with no src firing load events).