mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 21:54:36 +03:00
fix(html/parser): Fix fosting logic for text nodes (#4457)
This commit is contained in:
parent
c53778a3d8
commit
65a158a66b
@ -7462,9 +7462,41 @@ where
|
||||
}
|
||||
}
|
||||
}
|
||||
InsertionPosition::BeforeSibling(_node) => {
|
||||
// TODO improve me for another, not happens for comments right
|
||||
// now
|
||||
InsertionPosition::BeforeSibling(node) => {
|
||||
if let Some((parent, i)) = self.get_parent_and_index(node) {
|
||||
let mut children = parent.children.borrow_mut();
|
||||
|
||||
if let Some(previous) = children.get(i - 1) {
|
||||
if let Data::Text(text) = &previous.data {
|
||||
let mut new_value = String::new();
|
||||
|
||||
new_value.push_str(&*text.value);
|
||||
|
||||
match &token_and_info.token {
|
||||
Token::Character { value, .. } => {
|
||||
new_value.push(*value);
|
||||
}
|
||||
_ => {
|
||||
unreachable!();
|
||||
}
|
||||
}
|
||||
|
||||
let first_pos = text.span.lo;
|
||||
let last_pos = self.input.last_pos()?;
|
||||
|
||||
children[i - 1] = Node::new(Data::Text(Text {
|
||||
span: swc_common::Span::new(
|
||||
first_pos,
|
||||
last_pos,
|
||||
Default::default(),
|
||||
),
|
||||
value: new_value.into(),
|
||||
}));
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
A<table><tr> B</tr> C</table>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,186 @@
|
||||
{
|
||||
"type": "Document",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 132,
|
||||
"ctxt": 0
|
||||
},
|
||||
"mode": "no-quirks",
|
||||
"children": [
|
||||
{
|
||||
"type": "DocumentType",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 15,
|
||||
"ctxt": 0
|
||||
},
|
||||
"name": "html",
|
||||
"publicId": null,
|
||||
"systemId": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 16,
|
||||
"end": 125,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "html",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 0,
|
||||
"ctxt": 0
|
||||
},
|
||||
"namespace": null,
|
||||
"prefix": null,
|
||||
"name": "lang",
|
||||
"value": "en"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 33,
|
||||
"end": 68,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "head",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 39,
|
||||
"end": 44,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n "
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 44,
|
||||
"end": 59,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "title",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 51,
|
||||
"end": 59,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "Document"
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 67,
|
||||
"end": 68,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n"
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 75,
|
||||
"end": 76,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 76,
|
||||
"end": 125,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "body",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 82,
|
||||
"end": 116,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n A B C"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 88,
|
||||
"end": 99,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "table",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 99,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "tbody",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 95,
|
||||
"end": 99,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "tr",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 116,
|
||||
"end": 125,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n\n"
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,221 @@
|
||||
|
||||
x Document
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:1:1]
|
||||
1 | ,-> <!doctype html>
|
||||
2 | | <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | | A<table><tr> B</tr> C</table>
|
||||
8 | | </body>
|
||||
9 | `-> </html>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:1:1]
|
||||
1 | <!doctype html>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x DocumentType
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:1:1]
|
||||
1 | <!doctype html>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:2:1]
|
||||
2 | ,-> <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | | A<table><tr> B</tr> C</table>
|
||||
8 | `-> </body>
|
||||
9 | </html>
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:2:1]
|
||||
2 | ,-> <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | | A<table><tr> B</tr> C</table>
|
||||
8 | `-> </body>
|
||||
9 | </html>
|
||||
`----
|
||||
|
||||
x Attribute
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:1:1]
|
||||
1 | <!doctype html>
|
||||
: ^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:3:1]
|
||||
3 | ,-> <head>
|
||||
4 | `-> <title>Document</title>
|
||||
5 | </head>
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:3:1]
|
||||
3 | ,-> <head>
|
||||
4 | `-> <title>Document</title>
|
||||
5 | </head>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:3:1]
|
||||
3 | ,-> <head>
|
||||
4 | `-> <title>Document</title>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:3:1]
|
||||
3 | ,-> <head>
|
||||
4 | `-> <title>Document</title>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^^^^^^^^
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^
|
||||
5 | </head>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^
|
||||
5 | </head>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:5:1]
|
||||
5 | </head>
|
||||
: ^
|
||||
6 | <body>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:5:1]
|
||||
5 | </head>
|
||||
: ^
|
||||
6 | <body>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:6:1]
|
||||
6 | ,-> <body>
|
||||
7 | | A<table><tr> B</tr> C</table>
|
||||
8 | `-> </body>
|
||||
9 | </html>
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:6:1]
|
||||
6 | ,-> <body>
|
||||
7 | | A<table><tr> B</tr> C</table>
|
||||
8 | `-> </body>
|
||||
9 | </html>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:6:1]
|
||||
6 | ,-> <body>
|
||||
7 | `-> A<table><tr> B</tr> C</table>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:6:1]
|
||||
6 | ,-> <body>
|
||||
7 | `-> A<table><tr> B</tr> C</table>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:7:5]
|
||||
7 | A<table><tr> B</tr> C</table>
|
||||
: ^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:7:5]
|
||||
7 | A<table><tr> B</tr> C</table>
|
||||
: ^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:1:1]
|
||||
1 | ,-> <!doctype html>
|
||||
2 | | <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | `-> A<table><tr> B</tr> C</table>
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:1:1]
|
||||
1 | ,-> <!doctype html>
|
||||
2 | | <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | `-> A<table><tr> B</tr> C</table>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:7:5]
|
||||
7 | A<table><tr> B</tr> C</table>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:7:5]
|
||||
7 | A<table><tr> B</tr> C</table>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:7:5]
|
||||
7 | ,-> A<table><tr> B</tr> C</table>
|
||||
8 | `-> </body>
|
||||
9 | </html>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters-2/input.html:7:5]
|
||||
7 | ,-> A<table><tr> B</tr> C</table>
|
||||
8 | `-> </body>
|
||||
9 | </html>
|
||||
`----
|
@ -0,0 +1,9 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
A<table><tr> B</tr> </em>C</table>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,195 @@
|
||||
{
|
||||
"type": "Document",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 137,
|
||||
"ctxt": 0
|
||||
},
|
||||
"mode": "no-quirks",
|
||||
"children": [
|
||||
{
|
||||
"type": "DocumentType",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 15,
|
||||
"ctxt": 0
|
||||
},
|
||||
"name": "html",
|
||||
"publicId": null,
|
||||
"systemId": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 16,
|
||||
"end": 130,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "html",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 0,
|
||||
"ctxt": 0
|
||||
},
|
||||
"namespace": null,
|
||||
"prefix": null,
|
||||
"name": "lang",
|
||||
"value": "en"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 33,
|
||||
"end": 68,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "head",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 39,
|
||||
"end": 44,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n "
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 44,
|
||||
"end": 59,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "title",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 51,
|
||||
"end": 59,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "Document"
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 67,
|
||||
"end": 68,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n"
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 75,
|
||||
"end": 76,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 76,
|
||||
"end": 130,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "body",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 82,
|
||||
"end": 121,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n A BC"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 88,
|
||||
"end": 112,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "table",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 112,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "tbody",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 95,
|
||||
"end": 99,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "tr",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 106,
|
||||
"end": 112,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": " "
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 121,
|
||||
"end": 130,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n\n"
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,233 @@
|
||||
|
||||
x Document
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:1:1]
|
||||
1 | ,-> <!doctype html>
|
||||
2 | | <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | | A<table><tr> B</tr> </em>C</table>
|
||||
8 | | </body>
|
||||
9 | `-> </html>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:1:1]
|
||||
1 | <!doctype html>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x DocumentType
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:1:1]
|
||||
1 | <!doctype html>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:2:1]
|
||||
2 | ,-> <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | | A<table><tr> B</tr> </em>C</table>
|
||||
8 | `-> </body>
|
||||
9 | </html>
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:2:1]
|
||||
2 | ,-> <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | | A<table><tr> B</tr> </em>C</table>
|
||||
8 | `-> </body>
|
||||
9 | </html>
|
||||
`----
|
||||
|
||||
x Attribute
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:1:1]
|
||||
1 | <!doctype html>
|
||||
: ^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:3:1]
|
||||
3 | ,-> <head>
|
||||
4 | `-> <title>Document</title>
|
||||
5 | </head>
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:3:1]
|
||||
3 | ,-> <head>
|
||||
4 | `-> <title>Document</title>
|
||||
5 | </head>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:3:1]
|
||||
3 | ,-> <head>
|
||||
4 | `-> <title>Document</title>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:3:1]
|
||||
3 | ,-> <head>
|
||||
4 | `-> <title>Document</title>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^^^^^^^^
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^
|
||||
5 | </head>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^
|
||||
5 | </head>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:5:1]
|
||||
5 | </head>
|
||||
: ^
|
||||
6 | <body>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:5:1]
|
||||
5 | </head>
|
||||
: ^
|
||||
6 | <body>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:6:1]
|
||||
6 | ,-> <body>
|
||||
7 | | A<table><tr> B</tr> </em>C</table>
|
||||
8 | `-> </body>
|
||||
9 | </html>
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:6:1]
|
||||
6 | ,-> <body>
|
||||
7 | | A<table><tr> B</tr> </em>C</table>
|
||||
8 | `-> </body>
|
||||
9 | </html>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:6:1]
|
||||
6 | ,-> <body>
|
||||
7 | `-> A<table><tr> B</tr> </em>C</table>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:6:1]
|
||||
6 | ,-> <body>
|
||||
7 | `-> A<table><tr> B</tr> </em>C</table>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:7:5]
|
||||
7 | A<table><tr> B</tr> </em>C</table>
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:7:5]
|
||||
7 | A<table><tr> B</tr> </em>C</table>
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:1:1]
|
||||
1 | ,-> <!doctype html>
|
||||
2 | | <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | `-> A<table><tr> B</tr> </em>C</table>
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:1:1]
|
||||
1 | ,-> <!doctype html>
|
||||
2 | | <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | `-> A<table><tr> B</tr> </em>C</table>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:7:5]
|
||||
7 | A<table><tr> B</tr> </em>C</table>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:7:5]
|
||||
7 | A<table><tr> B</tr> </em>C</table>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:7:5]
|
||||
7 | A<table><tr> B</tr> </em>C</table>
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:7:5]
|
||||
7 | A<table><tr> B</tr> </em>C</table>
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:7:5]
|
||||
7 | ,-> A<table><tr> B</tr> </em>C</table>
|
||||
8 | `-> </body>
|
||||
9 | </html>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters-3/input.html:7:5]
|
||||
7 | ,-> A<table><tr> B</tr> </em>C</table>
|
||||
8 | `-> </body>
|
||||
9 | </html>
|
||||
`----
|
@ -0,0 +1,9 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
A<table>B<tr>C</tr>D</table>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,186 @@
|
||||
{
|
||||
"type": "Document",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 132,
|
||||
"ctxt": 0
|
||||
},
|
||||
"mode": "no-quirks",
|
||||
"children": [
|
||||
{
|
||||
"type": "DocumentType",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 15,
|
||||
"ctxt": 0
|
||||
},
|
||||
"name": "html",
|
||||
"publicId": null,
|
||||
"systemId": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 16,
|
||||
"end": 132,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "html",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "Attribute",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 0,
|
||||
"ctxt": 0
|
||||
},
|
||||
"namespace": null,
|
||||
"prefix": null,
|
||||
"name": "lang",
|
||||
"value": "en"
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 33,
|
||||
"end": 68,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "head",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 39,
|
||||
"end": 44,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n "
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 44,
|
||||
"end": 59,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "title",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 51,
|
||||
"end": 59,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "Document"
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 67,
|
||||
"end": 68,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n"
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 75,
|
||||
"end": 76,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 76,
|
||||
"end": 132,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "body",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 82,
|
||||
"end": 115,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n ABCD"
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 88,
|
||||
"end": 100,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "table",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 100,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "tbody",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 96,
|
||||
"end": 100,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "tr",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Text",
|
||||
"span": {
|
||||
"start": 115,
|
||||
"end": 132,
|
||||
"ctxt": 0
|
||||
},
|
||||
"value": "\n\n\n"
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,221 @@
|
||||
|
||||
x Document
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:1:1]
|
||||
1 | ,-> <!doctype html>
|
||||
2 | | <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | | A<table>B<tr>C</tr>D</table>
|
||||
8 | | </body>
|
||||
9 | `-> </html>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:1:1]
|
||||
1 | <!doctype html>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x DocumentType
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:1:1]
|
||||
1 | <!doctype html>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:2:1]
|
||||
2 | ,-> <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | | A<table>B<tr>C</tr>D</table>
|
||||
8 | | </body>
|
||||
9 | `-> </html>
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:2:1]
|
||||
2 | ,-> <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | | A<table>B<tr>C</tr>D</table>
|
||||
8 | | </body>
|
||||
9 | `-> </html>
|
||||
`----
|
||||
|
||||
x Attribute
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:1:1]
|
||||
1 | <!doctype html>
|
||||
: ^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:3:1]
|
||||
3 | ,-> <head>
|
||||
4 | `-> <title>Document</title>
|
||||
5 | </head>
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:3:1]
|
||||
3 | ,-> <head>
|
||||
4 | `-> <title>Document</title>
|
||||
5 | </head>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:3:1]
|
||||
3 | ,-> <head>
|
||||
4 | `-> <title>Document</title>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:3:1]
|
||||
3 | ,-> <head>
|
||||
4 | `-> <title>Document</title>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^^^^^^^^
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^
|
||||
5 | </head>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:4:5]
|
||||
4 | <title>Document</title>
|
||||
: ^
|
||||
5 | </head>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:5:1]
|
||||
5 | </head>
|
||||
: ^
|
||||
6 | <body>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:5:1]
|
||||
5 | </head>
|
||||
: ^
|
||||
6 | <body>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:6:1]
|
||||
6 | ,-> <body>
|
||||
7 | | A<table>B<tr>C</tr>D</table>
|
||||
8 | | </body>
|
||||
9 | `-> </html>
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:6:1]
|
||||
6 | ,-> <body>
|
||||
7 | | A<table>B<tr>C</tr>D</table>
|
||||
8 | | </body>
|
||||
9 | `-> </html>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:6:1]
|
||||
6 | ,-> <body>
|
||||
7 | `-> A<table>B<tr>C</tr>D</table>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:6:1]
|
||||
6 | ,-> <body>
|
||||
7 | `-> A<table>B<tr>C</tr>D</table>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:7:5]
|
||||
7 | A<table>B<tr>C</tr>D</table>
|
||||
: ^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:7:5]
|
||||
7 | A<table>B<tr>C</tr>D</table>
|
||||
: ^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:1:1]
|
||||
1 | ,-> <!doctype html>
|
||||
2 | | <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | `-> A<table>B<tr>C</tr>D</table>
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:1:1]
|
||||
1 | ,-> <!doctype html>
|
||||
2 | | <html lang="en">
|
||||
3 | | <head>
|
||||
4 | | <title>Document</title>
|
||||
5 | | </head>
|
||||
6 | | <body>
|
||||
7 | `-> A<table>B<tr>C</tr>D</table>
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:7:5]
|
||||
7 | A<table>B<tr>C</tr>D</table>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:7:5]
|
||||
7 | A<table>B<tr>C</tr>D</table>
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:7:5]
|
||||
7 | ,-> A<table>B<tr>C</tr>D</table>
|
||||
8 | | </body>
|
||||
9 | `-> </html>
|
||||
`----
|
||||
|
||||
x Text
|
||||
,-[$DIR/tests/fixture/tag/table-characters/input.html:7:5]
|
||||
7 | ,-> A<table>B<tr>C</tr>D</table>
|
||||
8 | | </body>
|
||||
9 | `-> </html>
|
||||
`----
|
Loading…
Reference in New Issue
Block a user