Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

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
@papandreou
Copy link
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' } ] } ]
@tautologistics

This comment has been minimized.

Copy link
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
You can’t perform that action at this time.