mirror of
https://github.com/remy/inliner.git
synced 2024-08-16 20:00:35 +03:00
fix: detect xml-mode with XML declaration
This commit is contained in:
parent
0ddff8886f
commit
925c99e2c3
@ -236,7 +236,7 @@ function main() {
|
||||
|
||||
// if we spot some SVG elements in the source,
|
||||
// then we'll parse as XML to correctly get the SVG
|
||||
if (body.indexOf('<svg') !== -1 || body.indexOf('<SVG') !== -1) {
|
||||
if (body.indexOf('<?xml') !== -1 || body.indexOf('<?XML') !== -1) {
|
||||
cheerioLoadOptions.xmlMode = true;
|
||||
}
|
||||
|
||||
|
1
test/fixtures/xml-detection.result.html
vendored
Normal file
1
test/fixtures/xml-detection.result.html
vendored
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>xml detection</title> </head> <body> <svg width="10" height="20"/> <div></div> </body> </html>
|
11
test/fixtures/xml-detection.src.html
vendored
Normal file
11
test/fixtures/xml-detection.src.html
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>xml detection</title>
|
||||
</head>
|
||||
<body>
|
||||
<svg width="10" height="20"></svg>
|
||||
<div></div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user