[whatwg] What should document.write() do when called from setTimeout or event handlers?

On Sun, 06 Aug 2006 06:38:58 +0700, Ian Hickson <ian at hixie.ch> wrote:

>>> IE seems to make those calls to document.write() simply blow away the
>>> document, as if the document was closed. Opera seems to do the same.

>> I think this is the best thing to do. Easy to implement and well-defined.

> It's not particularly well-defined, since you have to now make a
> distinction between scripts that are executing "inline", and scripts that
> were started by scripts executing inline but are actually executing in a
> different context. It basically means that the behaviour of
> document.write() depends on more than the current state of the browser, it
> depends on the call stack of the script executing. That's quite weird.

It's not that bad. It only depends on the open/closed state of the document, which is kept somewhere anyway. A call to document.close() or an end-of-stream closes a document.


-- 
Alexey Feldgendler <alexey at feldgendler.ru>
[ICQ: 115226275] http://feldgendler.livejournal.com

Received on Sunday, 6 August 2006 23:04:23 UTC