Open papandreou opened 12 years ago
var rawHtml = '<script>document.write("<!--hello-->");</script>', htmlparser = require('./lib/htmlparser'), handler = new htmlparser.DefaultHandler(), parser = new htmlparser.Parser(handler); parser.parseComplete(rawHtml); console.warn(require('util').inspect(handler.dom, false, null));
Output:
[ { raw: 'script', data: 'script', type: 'script', name: 'script', children: [ { raw: 'document.write("', data: 'document.write("', type: 'text' }, { raw: 'hello', data: 'hello', type: 'comment' }, { raw: '");', data: '");', type: 'text' } ] } ]
Expected output:
[ { raw: 'script', data: 'script', type: 'script', name: 'script', children: [ { raw: 'document.write("<!--hello-->");', data: 'document.write("<!--hello-->");', type: 'text' } ] } ]
If you have a patch or pull request I will apply it to the 1.x branch, otherwise I am focusing efforts on getting 2.x tested and released.
Output:
Expected output: