Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stray end tag [source] #694

Closed
slacto opened this issue Oct 28, 2019 · 5 comments
Closed

Stray end tag [source] #694

slacto opened this issue Oct 28, 2019 · 5 comments
Assignees

Comments

@slacto
Copy link

slacto commented Oct 28, 2019

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.

private static readonly HashSet<NamespaceName> SelfClosingElements = new HashSet<NamespaceName>(new []

@burningice2866
Copy link
Contributor

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

@slacto
Copy link
Author

slacto commented Oct 29, 2019

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.

@npwaa
Copy link

npwaa commented Oct 30, 2019

The proposed solution only works if prettifyPublicMarkup is used, this is where i need to add it

private static bool IsHtmlControlElement(XElement element)

@slacto
Copy link
Author

slacto commented Jan 17, 2020

Will this fix be included in future versions of C1?

@napernik napernik self-assigned this Jan 28, 2020
@napernik
Copy link
Contributor

napernik commented Jan 28, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants