views:

1099

answers:

2

My page validated error free against HTML5 until I added YouTube's embed code.

# Line 140, Column 132: Stray end tag param.

    …O30JM&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="tru

# Error Line 140, Column 183: Stray end tag param.

    …llowFullScreen" value="true"></param><param name="allowscriptaccess" value="a

# Error Line 140, Column 238: Stray end tag param.

    …scriptaccess" value="always"></param><embed src="http://www.youtube.com/v/1rW

# Error Line 140, Column 430: Stray end tag embed.

    …ways" allowfullscreen="true"></embed></object>

Is there a way to get object, embed and param tags validate against HTML5 ?

+2  A: 

Remove the end tags and replace them with self closing tags.

Eg.

<embed ...></embed>

<embed ... />
Charlie Somerville
Or just drop them entirely.
Ms2ger
You could, but I find something nice about self closing tags :)
Charlie Somerville
+1  A: 

Adding to Charlies answer, with some more detail:

Embed is a void element, i.e. it can have no content. Thus, it must not have closing tag, in the HTML serialization.

In the XHTML serialization it must be closed. XML parsers do not differentiate between self-closing tags and tags that are immediately (no white space) followed by a closing tag. But the latter is redundant and error prone, since white-space so easily slip in between the starting tag and the closing tag.

It may be written using the self-closing syntax, in the HTML serialization, which some authors, myself included, prefer as a style convention. It is ignored by the parsers, though.

Thus, the self closing syntax is always allowed on void elements, but sometimes redundant.

http://dev.w3.org/html5/markup/syntax.html#syntax-elements

itpastorn