edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Adam Thompson <arthompson1990@gmail.com>
To: Kevin Carhart <kevin_carhart@fastmail.fm>
Cc: edbrowse-dev@edbrowse.org
Subject: Re: document.write and innerHTML
Date: Mon, 14 Jun 2021 09:26:21 +0100	[thread overview]
Message-ID: <YMcSrbPneYLre+rx@toaster> (raw)
In-Reply-To: <3edfa643-fe10-4ab9-986c-fbcdd7a46193@www.fastmail.com>

On Fri, Jun 11, 2021 at 09:14:45PM -0700, Kevin Carhart wrote:
> Appends, so from the FF console if you send
> document.write(1);document.write(2);document.write(3)
> 
> document.body.innerHTML returns "123"
> 

As far as I can tell it's like a stream. When loading, the document is
opened for writing and thus document.write() appends. Once loading has
completed (when browsing) the document is closed. Thus, when
document.write() is called on an already closed document it first calls
document.open() which calls document.clear() (like using fopen with "w" as
the mode). Subsequent document.write() calls on the same document then find
the document is already opened and thus append. I'd need to check mdn again
but I'm not sure if there's also a document.close() call as well. All of
this sits below the DOM manipulation calls such that the DOM needs to be
adjusted after document-altering calls I think. I'm not sure how close this
is to what's currently implemented (especially after the last change) in
practical terms (e.g. if anyone widely uses document.open etc).

Cheers,
Adam.


      reply	other threads:[~2021-06-14  8:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21  8:59 [edbrowse-dev] proposal: moving #edbrowse from freenode to libera Kevin Carhart
2021-05-21 10:30 ` Chris Brannon
2021-06-01 21:04   ` Adam Thompson
2021-06-10  5:14     ` document.write and innerHTML Kevin Carhart
2021-06-10 11:49       ` Adam Thompson
2021-06-12  2:36         ` Karl Dahlke
2021-06-12  4:14           ` Kevin Carhart
2021-06-14  8:26             ` Adam Thompson [this message]

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=YMcSrbPneYLre+rx@toaster \
    --to=arthompson1990@gmail.com \
    --cc=edbrowse-dev@edbrowse.org \
    --cc=kevin_carhart@fastmail.fm \
    /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).