edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Karl Dahlke <eklhad@comcast.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] document.write atomic
Date: Mon, 28 Sep 2015 23:20:06 -0400	[thread overview]
Message-ID: <20150828232006.eklhad@comcast.net> (raw)

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

             reply	other threads:[~2015-09-29  3:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29  3:20 Karl Dahlke [this message]
2015-09-29  7:14 ` Adam Thompson
2015-09-29  9:51 ` Kevin Carhart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150828232006.eklhad@comcast.net \
    --to=eklhad@comcast.net \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).