Re: [VE] [79] Horizontal Rule <hr> Tags Break Paragraphs

On 16 Aug 2014, at 0:57, Pluto is a Planet wrote:

> While the reference states that any flow elements are permitted as 
> parents (including the p tag), the hr tag breaks a paragraph it’s 
> contained in so that it’s considered the end tag of a p tag. If you 
> do have a closing /p tag or text content after an hr tag, it’ll be 
> considered an error.

I don't know what reference you are looking at, but the specification 
says:

> 4.4.2 The hr element
>
> **Categories:**<br>
> Flow content.
> **Contexts in which this element can be used:**<br>
> Where flow content is expected.

and:

> 4.4.1 The p element
> …
> **Content model:**<br>
> Phrasing content.

Since the p element can contain only *phrasing* content, the hr element 
is not permitted inside (since it is allowed only where *flow* content 
is allowed).

> One of the details mentioned with this error is that it can be caused 
> “by an implicitly closed element (if you have an error related to an 
> element being used where it is not allowed, this is almost certainly 
> the case),” which seems to make sense, except there is no error in 
> validating the hr tag (nor should there be based on the 
> specification).

The end tag for the p element is optional.

Since the hr element is not allowed inside the p element, the hr start 
tag also ends the p element.

The p end tag therefore doesn't have an open p element to close.


-- 
David Dorward
http://dorward.co.uk/

Received on Saturday, 16 August 2014 22:29:59 UTC