edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] document.write atomic
@ 2015-09-29  3:20 Karl Dahlke
  2015-09-29  7:14 ` Adam Thompson
  2015-09-29  9:51 ` Kevin Carhart
  0 siblings, 2 replies; 3+ messages in thread
From: Karl Dahlke @ 2015-09-29  3:20 UTC (permalink / raw)
  To: Edbrowse-dev

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.
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("<P><a href=url>");
document.write("click on this baby");
document.write("</a>");

I'm pretty sure I've seen things like that, what do others say?
Parsing each string as an individual html document would not work.
The first string would degenerate to <a href=url></a>,
and the second would just be text not enclosed in a hyperlink,
and the third would be a close tag without an open tag and discarded.
That won't work.
If document.writes are as above,
then my current design is correct and should not change.
Build the writes up in a buffer and then parse the write buffer
after the script returns.
This is completely separate from the innerHTML strategy,
foo.innerHTML = string;
The string is the whole html in its entirety,
is to be parsed at this time,
and the js objects immediately available by the next line of javascript.
I just don't think document.write works that way,
but I have to suspend all coding until I have a confident answer to this question.

Karl Dahlke

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-29  9:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-29  3:20 [Edbrowse-dev] document.write atomic Karl Dahlke
2015-09-29  7:14 ` Adam Thompson
2015-09-29  9:51 ` Kevin Carhart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).