Skip to content

Commit

Permalink
Merge pull request #7 from GitScrum/master
Browse files Browse the repository at this point in the history
Fixed #6
  • Loading branch information
voischev committed Mar 4, 2016
2 parents 906fa7e + ea645e5 commit 95dabfc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function postHTMLParser(html) {

var parser = new htmlparser.Parser({
onprocessinginstruction: function(name, data) {
name === '!doctype' && results.push('<' + data + '>');
name.toLowerCase() === '!doctype' && results.push('<' + data + '>');
},
oncomment: function(data) {
var comment = '<!--' + data + '-->',
Expand Down Expand Up @@ -63,7 +63,7 @@ module.exports = function postHTMLParser(html) {
last.content || (last.content = []);
last.content.push(text);
}
}, {xmlMode: true});
}, {lowerCaseTags: false});

parser.write(html);
parser.end();
Expand Down
4 changes: 4 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ var it = require('mocha').it;
var expect = require('chai').expect;

describe('PostHTML-Parser test', function() {
it('should be parse doctype in uppercase', function() {
expect(parser('<!DOCTYPE html>')).to.eql(['<!DOCTYPE html>']);
});

it('should be parse comment', function() {
expect(parser('<!--comment-->')).to.eql(['<!--comment-->']);
});
Expand Down

0 comments on commit 95dabfc

Please sign in to comment.