File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ( ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ var it = require('mocha').it;
44var expect = require ( 'chai' ) . expect ;
55
66describe ( '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 } ) ;
You can’t perform that action at this time.
0 commit comments