Skip to content

Commit 95dabfc

Browse files
committed
Merge pull request #7 from GitScrum/master
Fixed #6
2 parents 906fa7e + ea645e5 commit 95dabfc

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function postHTMLParser(html) {
1616

1717
var parser = new htmlparser.Parser({
1818
onprocessinginstruction: function(name, data) {
19-
name === '!doctype' && results.push('<' + data + '>');
19+
name.toLowerCase() === '!doctype' && results.push('<' + data + '>');
2020
},
2121
oncomment: function(data) {
2222
var comment = '<!--' + data + '-->',
@@ -63,7 +63,7 @@ module.exports = function postHTMLParser(html) {
6363
last.content || (last.content = []);
6464
last.content.push(text);
6565
}
66-
}, {xmlMode: true});
66+
}, {lowerCaseTags: false});
6767

6868
parser.write(html);
6969
parser.end();

test/test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ var it = require('mocha').it;
44
var expect = require('chai').expect;
55

66
describe('PostHTML-Parser test', function() {
7+
it('should be parse doctype in uppercase', function() {
8+
expect(parser('<!DOCTYPE html>')).to.eql(['<!DOCTYPE html>']);
9+
});
10+
711
it('should be parse comment', function() {
812
expect(parser('<!--comment-->')).to.eql(['<!--comment-->']);
913
});

0 commit comments

Comments
 (0)