On Mon, Sep 28, 2015 at 11:20:06PM -0400, Karl Dahlke wrote: > This is mostly aimed at Kevin, our resident expert in html and js in the wild, > but I thought I'd post it here for all to consider. Yeah Kevin should have the final say on this since he's seen more of the internals of running websites. > A pivotal question influencing design is this. > Is document.write immediate and atomic? > I asked before and Kevin thought it was. > That as soon as I see document.write(string) I am to parse that html > and create the implied js objects etc etc. > And yet, I'm pretty sure I've seen websites, > I know I've written websites, wherein the write is not atomic, > and should not be parsed in isolation. > Example: > > document.write("

"); > document.write("click on this baby"); > document.write(""); > > I'm pretty sure I've seen things like that, what do others say? I looked this up and the closest "answer" I could find was the examples and explanation here: From this it looks like html is shoved into the document prior to parsing then the document is reparsed in the loading case. In the post-loading case it looks as if we need to replace everything in the document with the document.write output. Same goes for document.writeln I guess. Cheers, Adam.