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

Check data-* name restrictions #1107

Closed
mattgarrish opened this issue Mar 12, 2020 · 1 comment · Fixed by #1469
Closed

Check data-* name restrictions #1107

mattgarrish opened this issue Mar 12, 2020 · 1 comment · Fixed by #1469
Assignees
Labels
spec: EPUB 3.x Impacting the support of EPUB 3.x specifications status: has PR The issue is being processed in a pull request type: improvement The issue suggests an improvement of an existing feature
Milestone

Comments

@mattgarrish
Copy link
Member

I noticed that we check that data-* attributes are allowed in both XHTML and SVG content documents but we don't appear to be enforcing the naming restrictions in the HTML specification -- specifically that the name can't begin with "xml" or contain upper-ascii characters.

https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes

@rdeltour rdeltour added spec: EPUB 3.x Impacting the support of EPUB 3.x specifications status: in discussion The issue is being discussed by the development team type: improvement The issue suggests an improvement of an existing feature labels Mar 12, 2020
@rdeltour rdeltour added this to the v5.0.0-rc milestone Dec 8, 2022
@rdeltour rdeltour self-assigned this Dec 8, 2022
@rdeltour rdeltour added status: ready for implem The issue is ready to be implemented and removed status: in discussion The issue is being discussed by the development team labels Dec 8, 2022
rdeltour added a commit that referenced this issue Dec 23, 2022
According to HTML:
> A custom data attribute is an attribute in no namespace whose name
> starts with the string "data-", has at least one character after the
> hyphen, is XML-compatible, and contains no ASCII upper alphas.

This commit reports invalid `data-*` attributes as errors with a new
error code, `HTM-061`.

This should be ideally delegated to validator.nu, but we add this check
until we fully integrate the HTML checker.

Close #1107
@rdeltour
Copy link
Member

This should be ideally delegated to validator.nu, but I added a new check for it until we fully integrate the HTML checker.

I don't think validator.nu fully implements the rules btw (it does not complain if the attribute contains upper alphas). But in any case, I don't expect this check to report much new errors with existing content… we'll see!

@rdeltour rdeltour added status: has PR The issue is being processed in a pull request and removed status: ready for implem The issue is ready to be implemented labels Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec: EPUB 3.x Impacting the support of EPUB 3.x specifications status: has PR The issue is being processed in a pull request type: improvement The issue suggests an improvement of an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants