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

Ian Hickson ian at hixie.ch
Thu Aug 27 17:23:32 PDT 2009

On Sun, 16 Aug 2009, Kristof Zelechovski wrote:
>  1.  What counts for "script source" if the inline XML contained within 
> the SCRIPT tag is invalid, assuming that the document is HTML or the 
> document is XHTML and the embedded invalid XML code is within a CDATA 
> section so that the containing XHTML document is valid?

Could you give an example of what you mean? Maybe we are misunderstanding 
each other. I don't see how you can have any inline XML in text/html 
<script> (except, I guess, if another script generates it using the DOM), 
and ill-formed XML in an XML document causes the parser to abort long 
before we get to the script processing.

>  2.  Why don't you say that the "script source" for "text/javascript" is 
> the AST?  How would declaring the "script source" to be the embedded 
> text break XML-based script languages?  The interpreter can parse the 
> XML text itself, can't it?

(AST?) The whole point is that if the script is XML, there's no text to 
parse -- it's already a DOM.

>  3.  In general, I am asking that XML be treated just as all other 
> script types, unless you allow XML data in a SCRIPT element, where the 
> execution of such data means creating a new XML document and attaching 
> it to the SCRIPT element as a property for other scripts to peruse.  
> This is how it works in Internet Explorer.  Of course, such a script 
> cannot be used to handle events in the containing document.
> Example:
> 	<SCRIPT ID=M TYPE="text/xml" ><root /></SCRIPT >
> 	<SCRIPT TYPE="text/vbscript" ><!--
> 	REM --></SCRIPT >

There's no XML there, at least not in the sense used by the HTML5 spec.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list