diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-05-14 17:24:27 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-05-14 17:24:27 +0200 |
commit | f62af612c6e6217d7b2a1b064cdf10383524302b (patch) | |
tree | 09e6a49e4b819e6e510360898bfdff17251825e3 | |
parent | cd786ced0f04d9383cde1c451f0bab18135072bd (diff) |
Use text_stripped for javascript as well
-rw-r--r-- | include/HtmlParser.h | 1 | ||||
-rw-r--r-- | 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); |