fix(html/parser): Reflect the fix for a bug in spec (#5779)

This commit is contained in:
Alexander Akait 2022-09-16 06:24:49 +03:00 committed by GitHub
parent 99094def0e
commit 57e9f9c88e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 770 additions and 0 deletions

View File

@ -4518,6 +4518,7 @@ where
| &js_word!("tfoot")
| &js_word!("thead")
| &js_word!("tr")
| &js_word!("template")
) =>
{
true

View File

@ -0,0 +1,9 @@
| <!DOCTYPE html>
| <html>
| <head>
| <template>
| content
| <tr>
| <td>
| "cell"
| <body>

View File

@ -0,0 +1 @@
<!DOCTYPE HTML><template><tr><td>cell</td></tr></template>

View File

@ -0,0 +1,130 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 59,
"ctxt": 0
},
"mode": "no-quirks",
"children": [
{
"type": "DocumentType",
"span": {
"start": 1,
"end": 16,
"ctxt": 0
},
"name": "html",
"publicId": null,
"systemId": null,
"raw": "<!DOCTYPE HTML>"
},
{
"type": "Element",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tagName": "html",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tagName": "head",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 16,
"end": 59,
"ctxt": 0
},
"tagName": "template",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": {
"type": "DocumentFragment",
"span": {
"start": 16,
"end": 59,
"ctxt": 0
},
"children": [
{
"type": "Element",
"span": {
"start": 26,
"end": 48,
"ctxt": 0
},
"tagName": "tr",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 30,
"end": 43,
"ctxt": 0
},
"tagName": "td",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 34,
"end": 38,
"ctxt": 0
},
"data": "cell",
"raw": "cell"
}
],
"content": null,
"isSelfClosing": false
}
],
"content": null,
"isSelfClosing": false
}
]
},
"isSelfClosing": false
}
],
"content": null,
"isSelfClosing": false
},
{
"type": "Element",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tagName": "body",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": null,
"isSelfClosing": false
}
],
"content": null,
"isSelfClosing": false
}
]
}

View File

@ -0,0 +1,76 @@
x Document
,-[$DIR/tests/fixture/element/template-1/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/element/template-1/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^
`----
x DocumentType
,-[$DIR/tests/fixture/element/template-1/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^
`----
x Child
x Element
x Child
,-[$DIR/tests/fixture/element/template-1/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/fixture/element/template-1/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DocumentFragment
,-[$DIR/tests/fixture/element/template-1/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/element/template-1/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/fixture/element/template-1/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/element/template-1/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/fixture/element/template-1/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/element/template-1/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^
`----
x Text
,-[$DIR/tests/fixture/element/template-1/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^
`----

View File

@ -0,0 +1,13 @@
| <!DOCTYPE html>
| <html>
| <head>
| <template>
| content
| " "
| <tr>
| " "
| <td>
| "cell"
| " "
| " "
| <body>

View File

@ -0,0 +1 @@
<!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>

View File

@ -0,0 +1,170 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 63,
"ctxt": 0
},
"mode": "no-quirks",
"children": [
{
"type": "DocumentType",
"span": {
"start": 1,
"end": 16,
"ctxt": 0
},
"name": "html",
"publicId": null,
"systemId": null,
"raw": "<!DOCTYPE HTML>"
},
{
"type": "Element",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tagName": "html",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tagName": "head",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 16,
"end": 63,
"ctxt": 0
},
"tagName": "template",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": {
"type": "DocumentFragment",
"span": {
"start": 16,
"end": 63,
"ctxt": 0
},
"children": [
{
"type": "Text",
"span": {
"start": 26,
"end": 27,
"ctxt": 0
},
"data": " ",
"raw": " "
},
{
"type": "Element",
"span": {
"start": 27,
"end": 51,
"ctxt": 0
},
"tagName": "tr",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 31,
"end": 32,
"ctxt": 0
},
"data": " ",
"raw": " "
},
{
"type": "Element",
"span": {
"start": 32,
"end": 45,
"ctxt": 0
},
"tagName": "td",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 36,
"end": 40,
"ctxt": 0
},
"data": "cell",
"raw": "cell"
}
],
"content": null,
"isSelfClosing": false
},
{
"type": "Text",
"span": {
"start": 45,
"end": 46,
"ctxt": 0
},
"data": " ",
"raw": " "
}
],
"content": null,
"isSelfClosing": false
},
{
"type": "Text",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"data": " ",
"raw": " "
}
]
},
"isSelfClosing": false
}
],
"content": null,
"isSelfClosing": false
},
{
"type": "Element",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tagName": "body",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": null,
"isSelfClosing": false
}
],
"content": null,
"isSelfClosing": false
}
]
}

View File

@ -0,0 +1,124 @@
x Document
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^^^^^^^^^^^^^^^
`----
x DocumentType
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^^^^^^^^^^^^^^^
`----
x Child
x Element
x Child
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DocumentFragment
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^
`----
x Text
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^
`----
x Child
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^
`----
x Text
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^
`----
x Child
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^^^^
`----
x Text
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^^^^
`----
x Child
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^
`----
x Text
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^
`----
x Child
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^
`----
x Text
,-[$DIR/tests/fixture/element/template-2/input.html:1:1]
1 | <!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>
: ^
`----

View File

@ -0,0 +1,10 @@
| <!DOCTYPE html>
| <html>
| <head>
| <template>
| content
| <tr>
| <td>
| "cell"
| "a"
| <body>

View File

@ -0,0 +1 @@
<!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>

View File

@ -0,0 +1,140 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 60,
"ctxt": 0
},
"mode": "no-quirks",
"children": [
{
"type": "DocumentType",
"span": {
"start": 1,
"end": 16,
"ctxt": 0
},
"name": "html",
"publicId": null,
"systemId": null,
"raw": "<!DOCTYPE HTML>"
},
{
"type": "Element",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tagName": "html",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tagName": "head",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 16,
"end": 60,
"ctxt": 0
},
"tagName": "template",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": {
"type": "DocumentFragment",
"span": {
"start": 16,
"end": 60,
"ctxt": 0
},
"children": [
{
"type": "Element",
"span": {
"start": 26,
"end": 48,
"ctxt": 0
},
"tagName": "tr",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 30,
"end": 43,
"ctxt": 0
},
"tagName": "td",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 34,
"end": 38,
"ctxt": 0
},
"data": "cell",
"raw": "cell"
}
],
"content": null,
"isSelfClosing": false
}
],
"content": null,
"isSelfClosing": false
},
{
"type": "Text",
"span": {
"start": 48,
"end": 49,
"ctxt": 0
},
"data": "a",
"raw": "a"
}
]
},
"isSelfClosing": false
}
],
"content": null,
"isSelfClosing": false
},
{
"type": "Element",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tagName": "body",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": null,
"isSelfClosing": false
}
],
"content": null,
"isSelfClosing": false
}
]
}

View File

@ -0,0 +1,6 @@
x Misplaced non-space characters inside a table
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^
`----

View File

@ -0,0 +1,88 @@
x Document
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^^^^^^^^^^^^^^^
`----
x DocumentType
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^^^^^^^^^^^^^^^
`----
x Child
x Element
x Child
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x DocumentFragment
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^^^^^^^^^^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^^^^
`----
x Text
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^^^^
`----
x Child
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^
`----
x Text
,-[$DIR/tests/recovery/element/template-5/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr>a</template>
: ^
`----