Do a case insensitive comparison when checking whether we're inside <script> or <style> #43

merged 1 commit into from Apr 1, 2012


None yet

2 participants


Previously this test case failed:

var rawHtml = '<SCRIPT>document.write("</style>");</SCRIPT></body></html>',
    htmlparser = require('./lib/htmlparser'),
    handler = new htmlparser.DefaultHandler(),
    parser = new htmlparser.Parser(handler);
console.warn(require('util').inspect(handler.dom, false, null));


[ { raw: 'SCRIPT',
    data: 'SCRIPT',
    type: 'tag',
    name: 'SCRIPT',
     [ { raw: 'document.write("',
         data: 'document.write("',
         type: 'text' },
       { raw: '");', data: '");', type: 'text' } ] } ]

This patch fixes it so the output is:

[ { raw: 'SCRIPT',
    data: 'SCRIPT',
    type: 'script',
    name: 'script',
     [ { raw: 'document.write("</style>");',
         data: 'document.write("</style>");',
         type: 'text' } ] } ]

Thanks. Can't believe this did not come up before this!

I need to add some test cases for this as well...

@tautologistics tautologistics merged commit 403fe86 into tautologistics:master Apr 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment