UnquotedAttributeValue consumes slash of EndTag #14

Closed
opened 2024-03-05 16:59:09 +01:00 by milahu · 1 comment
milahu commented 2024-03-05 16:59:09 +01:00 (Migrated from github.com)
<hr singlequoted='val' doublequoted="val" unquoted=val noval= bool/>

actual

node 10 = StartTag                  : "<"                            : "<"
node 22 = TagName                   : "hr"                           : "hr"
node 24 = AttributeName             : "singlequoted"                 : " singlequoted"
node 25 = Is                        : "="                            : "="
node 26 = AttributeValue            : "'val'"                        : "'val'"
node 24 = AttributeName             : "doublequoted"                 : " doublequoted"
node 25 = Is                        : "="                            : "="
node 26 = AttributeValue            : "\"val\""                      : "\"val\""
node 24 = AttributeName             : "unquoted"                     : " unquoted"
node 25 = Is                        : "="                            : "="
node 27 = UnquotedAttributeValue    : "val"                          : "val"
node 24 = AttributeName             : "noval"                        : " noval"
node 25 = Is                        : "="                            : "="
node 27 = UnquotedAttributeValue    : "bool/"                        : " bool/"
node  4 = EndTag                    : ">"                            : ">"
node 16 = Text                      : "\n"                           : "\n"

expected

node 27 = UnquotedAttributeValue    : "bool"                         : " bool"
node  4 = EndTag                    : "/>"                           : "/>"
``` <hr singlequoted='val' doublequoted="val" unquoted=val noval= bool/> ``` actual ```js node 10 = StartTag : "<" : "<" node 22 = TagName : "hr" : "hr" node 24 = AttributeName : "singlequoted" : " singlequoted" node 25 = Is : "=" : "=" node 26 = AttributeValue : "'val'" : "'val'" node 24 = AttributeName : "doublequoted" : " doublequoted" node 25 = Is : "=" : "=" node 26 = AttributeValue : "\"val\"" : "\"val\"" node 24 = AttributeName : "unquoted" : " unquoted" node 25 = Is : "=" : "=" node 27 = UnquotedAttributeValue : "val" : "val" node 24 = AttributeName : "noval" : " noval" node 25 = Is : "=" : "=" node 27 = UnquotedAttributeValue : "bool/" : " bool/" node 4 = EndTag : ">" : ">" node 16 = Text : "\n" : "\n" ``` expected ``` node 27 = UnquotedAttributeValue : "bool" : " bool" node 4 = EndTag : "/>" : "/>" ```
marijnh commented 2024-03-06 10:14:59 +01:00 (Migrated from github.com)

This seems to align with how browsers interpret this, so it seems correct.

document.body.innerHTML = "<div a=foo/></div>" 
document.body.firstChild.getAttribute("a")
→ "foo/"
This seems to align with how browsers interpret this, so it seems correct. ``` document.body.innerHTML = "<div a=foo/></div>" document.body.firstChild.getAttribute("a") → "foo/" ```
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/html#14
No description provided.