tautologistics/node-htmlparser — pull request #43 by papandreou (2012-04-01 20:38:04+00:00)
Title: Do a case insensitive comparison when checking whether we're inside <script> or <style>

Previously this test case failed:

var rawHtml = '

',
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("");',
data: 'document.write("");',
type: 'text' } ] } ]