STINNER Victor <vstin...@python.org> added the comment:

HTML 5.2 specification says
https://www.w3.org/TR/html52/syntax.html#elements-attributes

"Attribute names must consist of one or more characters other than the space 
characters, U+0000 NULL, U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), 
U+003E GREATER-THAN SIGN (>), U+002F SOLIDUS (/), and U+003D EQUALS SIGN (=) 
characters, the control characters, and any characters that are not defined by 
Unicode."

It is confirmed in the "12.2 Parsing HTML documents" section of the "HTML 
Living Standard":
"""
12.2.5.33 Attribute name state

Consume the next input character:

U+0009 CHARACTER TABULATION (tab)
U+000A LINE FEED (LF)
U+000C FORM FEED (FF)
U+0020 SPACE
U+002F SOLIDUS (/)
U+003E GREATER-THAN SIGN (>)
EOF
    Reconsume in the after attribute name state.
U+003D EQUALS SIGN (=)
    Switch to the before attribute value state.
ASCII upper alpha
    Append the lowercase version of the current input character (add 0x0020 to 
the character's code point) to the current attribute's name.
U+0000 NULL
    This is an unexpected-null-character parse error. Append a U+FFFD 
REPLACEMENT CHARACTER character to the current attribute's name.
U+0022 QUOTATION MARK (")
U+0027 APOSTROPHE (')
U+003C LESS-THAN SIGN (<)
    This is an unexpected-character-in-attribute-name parse error. Treat it as 
per the "anything else" entry below.
Anything else
    Append the current input character to the current attribute's name.
"""
https://html.spec.whatwg.org/multipage/parsing.html#attribute-name-state

I understand that "," *is* a legit character in a HTML attribute name. So "a," 
and ",a" *are* valid HTML attribute names. Do I understand correctly?

----------
nosy: +vstinner

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41748>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to