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

feat: check "data-*" attributes name restrictions #1469

Merged
merged 1 commit into from
Jan 3, 2023

Conversation

rdeltour
Copy link
Member

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 rdeltour added this to the v5.0.0-rc milestone Dec 23, 2022
@rdeltour rdeltour self-assigned this Dec 23, 2022
@@ -64,6 +64,7 @@ HTM_058=HTML documents must be encoded in UTF-8, but UTF-16 was detected.
HTM_059=Viewport "%1$s" property must not be defined more than once, but found values [%2$s].
HTM_060a=EPUB reading systems must ignore secondary viewport meta elements in fixed-layout documents; viewport declaration "%1$s" will be ignored.
HTM_060b=EPUB reading systems must ignore viewport meta elements in reflowable documents; viewport declaration "%1$s" will be ignored.
HTM_061="%1$s" is not a valid custom data attributes (it must have at least one character after the hyphen, be XML-compatible, and contain no ASCII upper alphas).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/attributes/attribute/

I also wonder if "upper alphas" will be clear to general users. Might be safer to be more verbose with "uppercase letters".

Suggested change
HTM_061="%1$s" is not a valid custom data attributes (it must have at least one character after the hyphen, be XML-compatible, and contain no ASCII upper alphas).
HTM_061="%1$s" is not a valid custom data attribute (it must have at least one character after the hyphen, be XML-compatible, and not contain ASCII uppercase letters).

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
Base automatically changed from feat/link-vocab to main January 3, 2023 14:42
@rdeltour rdeltour merged commit 22f5994 into main Jan 3, 2023
@rdeltour rdeltour deleted the feat/data-attributes branch January 3, 2023 14:43
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

Successfully merging this pull request may close these issues.

Check data-* name restrictions
2 participants