Re: document.write from script-inserted external script

On Jul 28, 2009, at 09:24, Ian Hickson wrote:

> On Mon, 13 Jul 2009, Henri Sivonen wrote:
>> 
>> Could you please check if the specced behavior for 
>> http://hixie.ch/tests/adhoc/dom/level0/write/005.html is the wanted 
>> behavior and then write down what the wanted result is? (I'm not sure I 
>> got it right myself.)
> 
> I've updated the test to match what the spec says (and to more 
> dramatically demonstrate why I think what it says is substantially 
> preferable than what WebKit and Gecko do today).

Currently, in Gecko nightlies with the HTML5 parser enabled, I get:
"FAIL (class attribute present - appendChild()ed script took too long to run) - PASS"
and the document never finishes loading.

The script says
"else if (!document.getElementsByTagName("P")[0].hasAttribute('class'))
  s = 'FAIL (class attribute present - appendChild()ed script took too long to run)';"

The negation in the |if| condition doesn't match the message.

Furthermore, I don't see any part of the test setting or removing the class attribute.

Is the test now in the state that it is supposed to be in?

>> Also, have I understood correctly that insertion point is never 
>> undefined when there's an active parser that is a script-created parser 
>> and the tokenizer isn't tokenizing the synchronous part of a 
>> document.write()?
> 
> Not sure what you mean by the second part. The insertion point is never 
> undefined when there's an active script-creaed parser full stop.

It's not necessarily good to let the SVG load event or XBL constructors to call document.write() even in the script-created case.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Monday, 12 April 2010 12:55:59 UTC