Closed slacto closed 4 years ago
Reading the docs, source
is not even selfclosing - it simply doesn't have a closing tag.
While this violates rules of xml i'm not sure the fix proposed here is any better since <source />
is just as invalid as <source></source>
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source
Quotes from https://www.w3.org/TR/2011/WD-html-markup-20110405/syntax.html
The following is a complete list of the void elements in HTML: area, base, br, col, command, embed, hr, img, input, keygen, link, meta, param, source, track, wbr
5: Optionally, a "/" character, which may be present only if the element is a void element.
Void elements only have a start tag; end tags must not be specified for void elements.
The proposed solution only works if prettifyPublicMarkup is used, this is where i need to add it https://github.com/Orckestra/C1-CMS-Foundation/blob/2e33ce0f64163008171791784fa1e5238b6efb94/Composite/Core/WebClient/Renderings/Page/XElementToAspNetExtensions.cs#L169
Will this fix be included in future versions of C1?
Yes. Thank you for reporting the issue. I updated the list of void/self-closing elements in both XhtmlPrettifier and XElementToAspNetExtensions. For the new, ASP.NET-less rendering (and without the XhtmlPrettifier enabled), those html tags should be self-closed in the functions that are inserting them.
validator.w3.org gives me at lot of validation errors like "Stray end tag 'source'" because source-tags are closed with
"</source>"
instead of "/>". I guess adding "source" to the HashSet of SelfClosingElements might fix the problem. https://github.com/Orckestra/C1-CMS-Foundation/blob/2e33ce0f64163008171791784fa1e5238b6efb94/Composite/Core/Xml/XhtmlPrettifier.cs#L96