[whatwg] Handling </br> in the "after head" insertion mode
tommy at kvaleberg.com
Thu Dec 4 02:34:56 PST 2008
Consider the following simple markup:
If I run it through my parser, which is implemented after the html5
algorithm, the resulting dom is as follows:
The br end tag is a bit special, and should be handled as if it was a br
start tag. What happens here is as follows: The "before head" insertion
mode will, upon receiving a br end tag, create a head node and switch to
the "in head" insertion mode. "in head" will close the head node and
move on to the "after head" insertion mode. I was expecting "after head"
to see the </br> and do like it does on a start tag, which is to create
a body node and move to the "in body" state, but the </br> is just ignored.
I've changed my implementation of "after head" to handle </br> just like
the "in head" insertion mode, which is:
An end tag whose tag name is "br"
Act as described in the "anything else" entry below.
This results in the following dom, for the example above:
This matches Internet Explorer and Opera, but not Firefox and Safari.
Then again, it looks like Firefox and Safari ignore all </br> tags.
More information about the whatwg