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

Custom elements validation #94

Closed
otachasak opened this issue Apr 16, 2015 · 2 comments
Closed

Custom elements validation #94

otachasak opened this issue Apr 16, 2015 · 2 comments

Comments

@otachasak
Copy link

Hello, I would like to ask, how to to use this project to validate html5 with custom elements. If I use it the following error occurs: Element my-element not allowed as child of element...

Thank you

@sideshowbarker
Copy link
Contributor

See my answer at http://stackoverflow.com/questions/28508533/w3c-validation-for-ui-select/28711028#28711028

We don’t currently have a good solution for dealing with custom elements. They are strictly not valid HTML per the requirements HTML spec. That said, it would be nice to try to find a way to check documents that contain them. But we’re not going to be coming up with a way to do that any time in the near future, so I’m going to close out this issue rather than just leaving it hanging open forever.

If/when we ever do implement checker support for documents with custom elements, it will be a major new feature that we announce widely. But don’t expect to see that announcement any time soon.

@jfiala
Copy link

jfiala commented Sep 8, 2015

We are using Knockout custom components
(http://knockoutjs.com/documentation/component-overview.html) and currently pages using custom components fail html validation.
e.g.
<like-widget params="value: userRating"></like-widget>

However, to keep our pages valid, we are currently using the alternative syntax for Knockout custom components (<div data-bind="component: {name: 'like-widget', params: {value: userRating}"></div>), but this syntax is less readable.

The suggested solution would be:
a) Add a checkbox "Allow usage of custom elements"
b) Add a input field to enter a comma-separated list of all custom elements (whitelist)

If the user enters no whitelist, all elements containing a dash could be considered valid (and handled the same way as div's are).
If the users whitelists the custom components, you know exactly which ones are valid.

If you implement it this way, current users of the HTML validator wouldn't have any change in the validation behaviour and users wanting to use custom elements would be allowed to do so and could ensure their markup is valid.

Of course it would be even better, if it would be possible to declare the valid custom elements inside the page itself, but the specification seems to be currently in early draft mode (http://w3c.github.io/webcomponents/spec/custom/#custom-tag-example).

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

No branches or pull requests

3 participants