node-htmlparser icon indicating copy to clipboard operation
node-htmlparser copied to clipboard

Problem when a <script> tag is not closed.

Open davidfoliveira opened this issue 9 years ago • 0 comments

If the parsed document has a <script> tag which is not closed, the parser acts like the document had nothing. Example:

var
    htmlparser = require('htmlparser'),
    parser,
    pHandler,
    data = '<html><body><h1>Bla</h1><script src="somewhere"></body></html>';

pHandler = new htmlparser.DefaultHandler(function(err,doc){
    if ( err )
        throw err;
    console.log("doc: ",doc);
});

The result is: doc: []

davidfoliveira avatar Mar 23 '15 18:03 davidfoliveira