diff --git a/src/index.ts b/src/index.ts index 103d692..a8cee1c 100755 --- a/src/index.ts +++ b/src/index.ts @@ -113,7 +113,13 @@ export function parse(data: string, options = {} as Options) { if (kBlockTextElements[match[2]]) { // a little test to find next or ... const closeMarkup = '' + match[2] + '>'; - const index = data.indexOf(closeMarkup, kMarkupPattern.lastIndex); + const index = (() => { + if (options.lowerCaseTagName) { + return data.toLocaleLowerCase().indexOf(closeMarkup, kMarkupPattern.lastIndex); + } else { + return data.indexOf(closeMarkup, kMarkupPattern.lastIndex); + } + })(); if (options[match[2]]) { let text: string; if (index === -1) { diff --git a/test/html.js b/test/html.js index 0ea581d..054d7cf 100644 --- a/test/html.js +++ b/test/html.js @@ -83,6 +83,18 @@ describe('HTML Parser', function () { }); + it('should deal uppercase', function () { + const html = '

