fix: don't remove SSI

Fixes #110
This commit is contained in:
Remy Sharp 2016-07-31 13:07:55 +01:00
parent 701bf13678
commit 0ae1301641
3 changed files with 13 additions and 1 deletions

View File

@ -343,7 +343,8 @@ function removeComments(element, $) {
var i = nodes.length;
while (i--) {
if (nodes[i].type === 'comment' && nodes[i].nodeValue.indexOf('[') !== 0) {
var first = (nodes[i].nodeValue || '').charAt(0);
if (nodes[i].type === 'comment' && first !== '[' && first !== '#') {
$(nodes[i]).remove();
}
removeComments(nodes[i], $);

1
test/fixtures/ssi.result.html vendored Normal file
View File

@ -0,0 +1 @@
<!DOCTYPE html> <html> <head> <title>just a demo</title> </head> <body> <!--#include virtual="/includes/head.html"--> </body> </html>

10
test/fixtures/ssi.src.html vendored Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>just a demo</title>
</head>
<body>
<!--#include virtual="/includes/head.html"-->
<!-- but this should be removed -->
</body>
</html>