[whatwg] <noscript> should be allowed in <head>

On Wed, 30 May 2007 00:57:31 +0200, Anne van Kesteren <annevk at opera.com>  
wrote:

> On Wed, 30 May 2007 00:11:22 +0200, David Hyatt <hyatt at apple.com> wrote:
>> WinIE allows it, and we just changed WebKit to allow it too.
>
> So what exactly do you do when scripting is _disabled_ in this case? For  
> instance with <noscript><p></noscript> or <noscript><b></noscript>?

I tested this briefly.

    http://simon.html5.org/test/html/parsing/noscript-in-head/

Using the Live DOM Viewer isn't an option because scripting has to be  
disabled to test this, and IE7's web developer toolbar is lying whenever  
the DOM is not a tree... so I used .innerHTML here.


For reference, the input documents were:


001-BL
    <!doctype html><head>X</head><body>Y</body>

001
    <!doctype html><head><noscript>X</noscript></head><body>Y</body>

002-BL
    <!doctype html><head><link title="A">X<link
    title="B"></head><body>Y</body>

002
    <!doctype html><head><noscript><link title="A">X<link
    title="B"></noscript></head><body>Y</body>


Results:


                                .innerHTML

Test |                   IE7                    |         Opera
-----+------------------------------------------+-----------------------
001- | <HEAD></HEAD>                            | <HEAD><BODY>XY
BL   | <BODY>XY</BODY>                          |
-----+------------------------------------------+-----------------------
001  | <HEAD><NOSCRIPT></HEAD>                  | <HEAD><BODY>XY
      | <BODY>X</NOSCRIPT>Y</BODY>               |
-----+------------------------------------------+-----------------------
002- | <HEAD><LINK title=A></HEAD>              | <HEAD><LINK
BL   | <BODY>X<LINK title=B>Y</BODY>            | title="A"><BODY>X<LINK
      |                                          | title="B">Y
-----+------------------------------------------+-----------------------
002  | <HEAD><NOSCRIPT><LINK title=A></HEAD>    | <HEAD><LINK
      | <BODY>X<LINK title=B></NOSCRIPT>Y</BODY> | title="A"><BODY>X<LINK
      |                                          | title="B">Y


In Firefox, <noscript> always imply <body>.

I don't have access to Safari right now.


If we want to allow NOSCRIPT in HEAD, then it seems to me that the most  
logical way to parse non-HEAD content inside it (which would be a parse  
error) is to pop the NOSCRIPT element and then reprocess as if it was  
found in HEAD directly.


.innerHTML for 001 would then look like:

    <head><noscript></noscript></head><body>XY</body>

and 002:

    <head><noscript><link title="A"></noscript><link
    title="B"></head><body>XY</body>

(...assuming that LINKs are still moved to HEAD.)


Cheers,
-- 
Simon Pieters

Received on Tuesday, 29 May 2007 20:44:19 UTC