<LINK> should never load when emebedded into the <BODY> element.

RESOLVED INVALID

Status

()

Core
HTML: Parser
RESOLVED INVALID
10 years ago
10 years ago

People

(Reporter: F. REMY, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 3.0.04506.30; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)
Build Identifier: 2.0.1.14

<html>
    <body>
        <!-- Should be ignored -->
        <link 
          rel="stylesheet"
          href="data:text/css,html{color: red}"
        />
        <!-- Content of the document -->
        <div>This should be black.</div>
     </body>
</html>

Reproducible: Always

Steps to Reproduce:
1. Create an HTML page with a LINK in the BODY
2. Run the page
3. See that the LINK were applied
Actual Results:  
The LINK is applied as it was in the HEAD section, which is not true.
In fact, the LINK is moved to the HEAD section (you can see through the DOM).

The LINK tag should not move and should be ignored.

Expected Results:  
"Unlike A, it [[ the LINK tag ]] may only appear in the HEAD section of a document." (HTM4)


"Where this tag [[LINK]] may be used :
- Where metadata content is expected. [[And thus not in the BODY]]
- In a noscript element that is a child of a head element. " (html5)

==> Both specify that LINK can't be in the BODY tag, and should thus be ignored (as the BASE tag is when putted in the BODY tag)

http://www.w3.org/TR/html4/struct/links.html#h-12.3
http://www.w3.org/TR/html5/#base

Comment 1

10 years ago
Creating independent test case in HTML 4.01, and XHTML 1.0.

Comment 2

10 years ago
Created attachment 330107 [details]
HTML 4.01 testcase

Here is the HTML 4.01 Test Case for this bug.

Comment 3

10 years ago
Created attachment 330109 [details]
XHTML 1.0 testcase

XHTML 1.0 DOCTYPE testcase

Comment 4

10 years ago
Created attachment 330110 [details]
No DOCTYPE testcase

This testcase has no DOCTYPE.

Comment 5

10 years ago
All of these test cases show the text as red in Firefox 3.0 on XP, and in Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1a1pre) Gecko/2008071703 Minefield/3.1a1pre on Vista. However, they show as black (correct) in IE7 and IE8 B1, so it is a FF issue.

Comment 6

10 years ago
Don't stop reading specs as soon as you find something you like.

From the HTML5 draft cited in comment 0:

8.2
(...)
For HTML documents, user agents must use the parsing rules described in this section to generate the DOM trees. Together, these rules define what is referred to as the HTML parser.
(...)
This specification defines the parsing rules for HTML documents, whether they are syntactically correct or not. 
(...)

8.2.5.10. The "in body" insertion mode
(...)
A start tag token whose tag name is one of: "base", "command", "eventsource", "link", "meta", "noframes", "script", "style", "title"

    Process the token using the rules for the "in head" insertion mode.

In summary, moving the element to the head is the correct behavior.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.