W3C home > Mailing lists > Public > public-html@w3.org > January to March 2007

Re: HTML parsing, <script>, and document.write() test/issue details?

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Thu, 15 Mar 2007 14:26:50 +1100
Message-ID: <45F8BCFA.9030603@lachy.id.au>
To: Dan Connolly <connolly@w3.org>
Cc: public-html@w3.org

Dan Connolly wrote:
> I'd like to know more about the details. I'd particularly appreciate
> it if somebody would put together a few test cases that show
> how parsing rules are integrated with <script> and document.write().

The spec has a diagram that illustrates how document.write() is 
integrated with the parsing by injecting markup back into the input 
stream [1].

This test case illustrates how document.write() can change the parsing:

<!DOCTYPE html>
   <p>Is this paragraph within the div or not?

When script is enabled, the p is a sibling of the div and the </div> at 
the end will generate a parsing error.  When script is disabled, the p 
is a child of the div and there is no parsing error.

[1] http://www.whatwg.org/specs/web-apps/current-work/#overview

Lachlan Hunt
Received on Thursday, 15 March 2007 03:26:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 15 March 2007 03:26:43 GMT