mirror of
https://github.com/swc-project/swc.git
synced 2024-11-28 02:29:04 +03:00
fix(html/parser): Fix error reporting related to image
(#4720)
This commit is contained in:
parent
db96405e8e
commit
4cee4ac238
@ -3554,9 +3554,7 @@ where
|
||||
ErrorKind::UnexpectedImageStartTag,
|
||||
));
|
||||
|
||||
let mut new_token_and_info = token_and_info.clone();
|
||||
|
||||
match &mut new_token_and_info {
|
||||
match token_and_info {
|
||||
TokenAndInfo {
|
||||
token: Token::StartTag { tag_name, .. },
|
||||
..
|
||||
@ -3568,7 +3566,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
self.process_token(&mut new_token_and_info, None)?;
|
||||
self.process_token(token_and_info, None)?;
|
||||
}
|
||||
// A start tag whose tag name is "textarea"
|
||||
//
|
||||
|
@ -0,0 +1,5 @@
|
||||
| <!DOCTYPE html>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <img>
|
@ -0,0 +1 @@
|
||||
<!doctype html><image/>
|
@ -0,0 +1,76 @@
|
||||
{
|
||||
"type": "Document",
|
||||
"span": {
|
||||
"start": 1,
|
||||
"end": 24,
|
||||
"ctxt": 0
|
||||
},
|
||||
"mode": "no-quirks",
|
||||
"children": [
|
||||
{
|
||||
"type": "DocumentType",
|
||||
"span": {
|
||||
"start": 1,
|
||||
"end": 16,
|
||||
"ctxt": 0
|
||||
},
|
||||
"name": "html",
|
||||
"publicId": null,
|
||||
"systemId": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 24,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "html",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 24,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "head",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
},
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 0,
|
||||
"end": 24,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "body",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "Element",
|
||||
"span": {
|
||||
"start": 16,
|
||||
"end": 24,
|
||||
"ctxt": 0
|
||||
},
|
||||
"tagName": "img",
|
||||
"namespace": "http://www.w3.org/1999/xhtml",
|
||||
"attributes": [],
|
||||
"children": [],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
],
|
||||
"content": null
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
|
||||
x Unexpected "<image>" start tag, only "<img>" tag exists in HTML
|
||||
,-[$DIR/tests/recovery/element/image-1/input.html:1:1]
|
||||
1 | <!doctype html><image/>
|
||||
: ^^^^^^^^
|
||||
`----
|
@ -0,0 +1,34 @@
|
||||
|
||||
x Document
|
||||
,-[$DIR/tests/recovery/element/image-1/input.html:1:1]
|
||||
1 | <!doctype html><image/>
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/image-1/input.html:1:1]
|
||||
1 | <!doctype html><image/>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x DocumentType
|
||||
,-[$DIR/tests/recovery/element/image-1/input.html:1:1]
|
||||
1 | <!doctype html><image/>
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Child
|
||||
|
||||
x Element
|
||||
|
||||
x Child
|
||||
,-[$DIR/tests/recovery/element/image-1/input.html:1:1]
|
||||
1 | <!doctype html><image/>
|
||||
: ^^^^^^^^
|
||||
`----
|
||||
|
||||
x Element
|
||||
,-[$DIR/tests/recovery/element/image-1/input.html:1:1]
|
||||
1 | <!doctype html><image/>
|
||||
: ^^^^^^^^
|
||||
`----
|
Loading…
Reference in New Issue
Block a user