chore: Merge branch 'ueokande-fix_forced_xml_mode'

* ueokande-fix_forced_xml_mode:
  fix: detect xml-mode with XML declaration
This commit is contained in:
Remy Sharp 2016-05-21 16:25:27 +01:00
commit cc9cc826ec
3 changed files with 13 additions and 1 deletions

View File

@ -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;
}

View 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
View 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>