diff --git a/src/parse-tag.js b/src/parse-tag.js index 137d690..570436d 100644 --- a/src/parse-tag.js +++ b/src/parse-tag.js @@ -14,7 +14,7 @@ export default function stringify(tag) { if (tagMatch) { res.name = tagMatch[1] if ( - lookup[tagMatch[1].toLowerCase()] || + lookup[tagMatch[1]] || tag.charAt(tag.length - 2) === '/' ) { res.voidElement = true diff --git a/test/parse.js b/test/parse.js index 9a49ab8..1ea26bf 100644 --- a/test/parse.js +++ b/test/parse.js @@ -934,5 +934,41 @@ test('whitespace', function (t) { }], 'should collapse whitespace') // See https://www.w3.org/TR/html4/struct/text.html#h-9.1 + t.end() +}) + +test('uppercase tags', function (t) { + const html = '<0>click here for more' + const parsed = HTML.parse(html) + t.deepEqual(parsed, [ + { + "type": "tag", + "name": "0", + "voidElement": false, + "attrs": {}, + "children": [ + { + "type": "text", + "content": "click " + }, + { + "type": "tag", + "name": "Link", + "voidElement": false, + "attrs": {}, + "children": [ + { + "type": "text", + "content": "here" + } + ] + }, + { + "type": "text", + "content": " for more" + } + ] + } + ], 'should handle uppercase tags correctly') t.end() }) \ No newline at end of file