- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Thu, 15 Mar 2007 14:26:50 +1100
- 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>
<title>document.write()</title>
<body>
<div>
<script>
document.write("<\/div>");
</script>
<p>Is this paragraph within the div or not?
</div>
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
http://lachy.id.au/
Received on Thursday, 15 March 2007 03:26:42 UTC