fix: raw text end tags should be case insensitive

This commit is contained in:
Ika 2019-10-04 20:48:11 +08:00
parent 0a4bfb63a6
commit 15c9cdb62f
2 changed files with 7 additions and 5 deletions

View File

@ -161,9 +161,11 @@ Raw text elements
(raw_text) (raw_text)
(end_tag (tag_name))) (end_tag (tag_name)))
(text) (text)
(ERROR (script_element
(start_tag (tag_name)) (start_tag (tag_name))
(raw_text))) (raw_text)
(end_tag (tag_name)))
(text))
================================== ==================================
All-caps doctype All-caps doctype

View File

@ -123,12 +123,12 @@ struct Scanner {
lexer->mark_end(lexer); lexer->mark_end(lexer);
const string &end_delimiter = tags.back().type == SCRIPT const string &end_delimiter = tags.back().type == SCRIPT
? "</script" ? "</SCRIPT"
: "</style"; : "</STYLE";
unsigned delimiter_index = 0; unsigned delimiter_index = 0;
while (lexer->lookahead) { while (lexer->lookahead) {
if (lexer->lookahead == end_delimiter[delimiter_index]) { if (towupper(lexer->lookahead) == end_delimiter[delimiter_index]) {
delimiter_index++; delimiter_index++;
if (delimiter_index == end_delimiter.size()) break; if (delimiter_index == end_delimiter.size()) break;
lexer->advance(lexer, false); lexer->advance(lexer, false);