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

No error when using ASCII upper alphas in Attribute Name for Custom Data Attributes #1704

Open
taconasu opened this issue Mar 23, 2024 · 1 comment

Comments

@taconasu
Copy link

taconasu commented Mar 23, 2024

URL being validated or code to reproduce error:

<!DOCTYPE html>
<html lang="en">
<head>
<title>Test</title>
</head>
<body>
<p data-FOO="foo">correct??</p>
</body>
</html>

The following specifications would be violated.
If the interpretation is incorrect and is a normal validation, please close. 🫣

3.2.6.6 Embedding custom non-visible data with the data-* attributes

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.

@sideshowbarker
Copy link
Contributor

sideshowbarker commented Apr 18, 2024

The violation in the spec applies to the parsed document in the DOM and not to any pre-parsed source markup.

And the HTML checker operates on the parsed document in the DOM, not on the source markup.

See more at #1668 (comment)

To put that in other words: Your source markup represents instructions to the HTML parser — and this instruction:

<p data-FOO="foo">

…to an HTML parser means exactly the same thing at this instruction:

<p data-foo="foo">

And in both cases, what the HTML parser creates in the DOM is <p data-foo="foo">.
That is, an HTML parser reads the markup data-FOO="foo" as meaning data-foo="foo".

To clarify a bit further — to an HTML parser, this markup:

<!DOCTYPE HTML>
<HTML LANG="en">
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<P DATA-FOO="FOO">correct??</P>
</BODY>
</HTML>

…means exactly the same thing as this markup:

<!DOCTYPE html>
<html lang="en">
<head>
<title>Test</title>
</head>
<body>
<p data-FOO="foo">correct??</p>
</body>
</html>

And in fact to an HTML parser the following:

<!DOCTYPE html>
<html lang=en>
<title>Test</title>
<p data-FOO=foo>correct??</p>

… is also exactly the same thing as those above.

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

2 participants