[whatwg] scripts, defer, document.write and DOMContentLoaded

Kristof Zelechovski giecrilj at stegny.2a.pl
Tue Jul 21 11:02:20 PDT 2009


The specification says:

For historical reasons, if the URL is a javascript: URL, then the user agent
must not, despite the requirements in the definition of the fetching
algorithm, actually execute the given script; instead the user agent must
act as if it had received an empty HTTP 400 response. [4.3.1]


(This is probably needed because the script block type overrides the script
type, which is, in this case, text/html.)

While we are at it:

	1. What is the script source of inline script[@type='text/xml']?
The rules are contradictory: source = text because it is text-based and
source = infoset because it is XML-based.  (An external script is created
with the source text without any preliminary parsing.)  Does being XML
override being text?  
	2. Why is the special provision for XML needed at all?  Does it
require invoking an embedded XML parser before the script is created?  Does
it allow nested script elements?  (That would not be backwards-compatible
and it would be fatal for HTML error recovery.)  What if the XML is not
well-formed?  Is the embedded parser allowed to validate the XML?  What if
validation fails?  Are external DTD allowed? --- forbidden?  Are XHTML
scripts embedded in the XML code allowed to run in this step?  (they should
not be!)
	3. Why is the script source for XML-based scripts allowed to be a
node list?  Internet Explorer supports only well-formed XML documents, i.e.
single trees, otherwise you get a parse error which is not very useful,
except for the developer.
	4. Is script[@type='text/xml'] allowed to be externally loaded?  (I
suppose that it is allowed, if supported by the browser, in spite of the
specification requiring data scripts to be inline.)
	5. Is the browser allowed to expose the embedded XML document using
a custom DOM property like XMLDocument?  Creating an XML script means
attaching the infoset to the declaring script element in Internet Explorer.

I think most of these questions would be void (postponed to the creation
phase where the answers are implementation-defined) if the special
definition of source for inline XML script blocks was removed.

Thx in advance,
Chris




More information about the whatwg mailing list