From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17956 invoked from network); 14 Jun 2021 08:27:08 -0000 Received: from hurricane.the-brannons.com (2602:ff06:725:1:20::25) by inbox.vuxu.org with ESMTPUTF8; 14 Jun 2021 08:27:08 -0000 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by hurricane.the-brannons.com (OpenSMTPD) with ESMTP id f07a38d4 for ; Mon, 14 Jun 2021 01:26:59 -0700 (PDT) Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [2a00:1450:4864:20::329]) by hurricane.the-brannons.com (OpenSMTPD) with ESMTPS id 21b724b3 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Mon, 14 Jun 2021 01:26:27 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id f17so11599155wmf.2 for ; Mon, 14 Jun 2021 01:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=8tso8akdQKhQMT/ZBnT2mX88qcd+7cmkC/JdeP9sXeI=; b=OkXAQRu9c1AChtgEy91YD1GX5SH88/1S645JXBCK4/NgQ15XZFGfmbzhvL05dBbbKH UON0G1xBoqT50/ES00G9TLpK6PsIWTk3XU/RtM24IU+GXYqR+ZJ3+b2CnZ0uCETMGn/J 9xyQuxj/i7LpFz5MQwLGx8Dt5wPxWC67DtglXPEY473+8k9SWnVgv+39WJ5nQ40CpULr 2iPisVEfjsZ55RNzL4WZEYnX4arSkQGOzMndf5vI1TtA/I9gOSqn1GTHHxeV8mw0/OUQ IUPh4J00J7sp8/I/hnbaMEAIEZohbYzQO+I4P7QhuOXGUZWjlhPNB/gWeKq96lch3v+f 0UBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8tso8akdQKhQMT/ZBnT2mX88qcd+7cmkC/JdeP9sXeI=; b=RV4LWjdl3Kp1vCkTtOaYv/Z5GbeCL/d4WSoEhoovU4pevgwJn367UvxVnQBQRf61uy ZAeL8XWT+t0n7X9CgjoqEBPNaRcwHrTyFIqP3hOrzN4VYsDZdPzaOQahCp2uJTVwazmj eZciMJ1qn2IY48bcpu7F6Q5+aLYMHCB/DQg23fiNTcthIMlzzjgTIkUruV0iNOQY5YVZ BrWV97UvSuekkyVVEB7CCRy02N5Egu2azZiny15xTAWIyhc/NcPRPG/JoPUkoCIDgZ5y W/aiYWl4Pj82jx1s9rh44IzCg5HrNb0QAXcLpa+My7wrdt8/T1EvS1ZBSirq9jheguVV rgxg== X-Gm-Message-State: AOAM532l5uq7Gy/1vrj+7+S+GVSy8Zs9iNFk6djyQiyM95w3D6JNjRnl gLEhq/h+LAwU1sZJ3hlkJ88= X-Google-Smtp-Source: ABdhPJx14va3Z65UjS86cByuczHERRezumH+znW31BWohExu8bsqB37WYfk9zgtOq4Q7EUANmaQ6Tg== X-Received: by 2002:a1c:5407:: with SMTP id i7mr31795228wmb.21.1623659183440; Mon, 14 Jun 2021 01:26:23 -0700 (PDT) Received: from toaster (b.5.b.9.4.f.e.f.f.f.c.f.1.b.a.e.1.4.0.9.2.4.1.1.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1142:9041:eab1:fcff:fef4:9b5b]) by smtp.gmail.com with ESMTPSA id x7sm16134402wre.8.2021.06.14.01.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 01:26:22 -0700 (PDT) Date: Mon, 14 Jun 2021 09:26:21 +0100 From: Adam Thompson To: Kevin Carhart Cc: edbrowse-dev@edbrowse.org Subject: Re: document.write and innerHTML Message-ID: References: <20210511223642.eklhad@comcast.net> <3edfa643-fe10-4ab9-986c-fbcdd7a46193@www.fastmail.com> X-BeenThere: edbrowse-dev@edbrowse.org List-Id: Edbrowse Development List MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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.