From f62af612c6e6217d7b2a1b064cdf10383524302b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 14 May 2020 17:24:27 +0200 Subject: Use text_stripped for javascript as well --- include/HtmlParser.h | 1 - src/HtmlParser.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/HtmlParser.h b/include/HtmlParser.h index fc3ff3a..45dc1e1 100644 --- a/include/HtmlParser.h +++ b/include/HtmlParser.h @@ -38,7 +38,6 @@ struct HtmlParser { HtmlStringView attribute_key; HtmlStringView attribute_value; HtmlStringView text; - /* Only used when parse_type is HTML_PARSE_TEXT */ HtmlStringView text_stripped; int is_tag_void; diff --git a/src/HtmlParser.c b/src/HtmlParser.c index f300b62..965368e 100644 --- a/src/HtmlParser.c +++ b/src/HtmlParser.c @@ -253,7 +253,7 @@ static void html_parser_goto_script_end_tag(HtmlParser *self) { html_parser_goto_end_of_js_string(self, c); } else if(c == '<' && self->offset + 7 < self->source_len && memcmp(self->source + self->offset + 1, "/script", 7) == 0) { self->text.size = (self->source + self->offset) - self->text.data; - strip(self->text.data, self->text.size, &self->text.data, &self->text.size, is_whitespace); + strip(self->text.data, self->text.size, &self->text_stripped.data, &self->text_stripped.size, is_whitespace); self->offset += 7; for(;;) { c = html_parser_peek_char(self); @@ -269,7 +269,7 @@ static void html_parser_goto_script_end_tag(HtmlParser *self) { break; } else if(c == '\0') { self->text.size = (self->source + self->offset) - self->text.data; - strip(self->text.data, self->text.size, &self->text.data, &self->text.size, is_whitespace); + strip(self->text.data, self->text.size, &self->text_stripped.data, &self->text_stripped.size, is_whitespace); break; } else { html_parser_advance_char(self); -- cgit v1.2.3