Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Apr 1, 2012

Conversation

Projects
None yet
2 participants
Contributor

papandreou commented Apr 1, 2012

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);
parser.parseComplete(rawHtml);
console.warn(require('util').inspect(handler.dom, false, null));

Output:

[ { raw: 'SCRIPT',
    data: 'SCRIPT',
    type: 'tag',
    name: 'SCRIPT',
    children: 
     [ { 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',
    children: 
     [ { raw: 'document.write("</style>");',
         data: 'document.write("</style>");',
         type: 'text' } ] } ]
Owner

tautologistics commented Apr 1, 2012

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

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

tautologistics added a commit that referenced this pull request Apr 1, 2012

Merge pull request #43 from papandreou/master
Do a case insensitive comparison when checking whether we're inside <script> or <style>

@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