I have read that it is bad to do this, and outside the spec, but I have an error that is somewhat intermittent, and may be related. Just want to know if the general consensus i
Fundamentally, it's invalid markup and a parsing error that the browser will have to recover from. So I would test this in your target browsers to see what they do.
In theory: After the closing tag and before the opening
tag, the parser is in "'after head' insertion mode". I've listed the rules for that below, but thanks to your comment, I think the relevant one is:
- A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "template", "title"
- Parse error.
- Push the node pointed to by the head element pointer onto the stack of open elements.
- Process the token using the rules for the "in head" insertion mode.
- Remove the node pointed to by the head element pointer from the stack of open elements. (It might not be the current node at this point.)
- The head element pointer cannot be null at this point.
Which tells us that:
head
.The full rules:
When the user agent is to apply the rules for the "after head" insertion mode, the user agent must handle the token as follows:
A character token that is one of U+0009 CHARACTER TABULATION, "LF" (U+000A), "FF" (U+000C), "CR" (U+000D), or U+0020 SPACE
- Insert the character.
A comment token
- Insert a comment.
A DOCTYPE token
- Parse error. Ignore the token.
A start tag whose tag name is "html"
- Process the token using the rules for the "in body" insertion mode.
A start tag whose tag name is "body"
- Insert an HTML element for the token.
- Set the frameset-ok flag to "not ok".
- Switch the insertion mode to "in body".
A start tag whose tag name is "frameset"
- Insert an HTML element for the token.
- Switch the insertion mode to "in frameset".
A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "template", "title"
- Parse error.
- Push the node pointed to by the head element pointer onto the stack of open elements.
- Process the token using the rules for the "in head" insertion mode.
- Remove the node pointed to by the head element pointer from the stack of open elements. (It might not be the current node at this point.)
- The head element pointer cannot be null at this point.
An end tag whose tag name is "template"
- Process the token using the rules for the "in head" insertion mode.
An end tag whose tag name is one of: "body", "html", "br"
- Act as described in the "anything else" entry below.
A start tag whose tag name is "head"
Any other end tag
- Parse error. Ignore the token.
Anything else
- Insert an HTML element for a "body" start tag token with no attributes.
- Switch the insertion mode to "in body".
- Reprocess the current token.