From 684a3bc56d5c40ed3eb54ca263751fa4724e73fa Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 6 Nov 2022 13:50:16 +0100 Subject: Call callback even if text only contains whitespace --- src/HtmlParser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/HtmlParser.c b/src/HtmlParser.c index fafcf5a..5f57dd3 100644 --- a/src/HtmlParser.c +++ b/src/HtmlParser.c @@ -297,7 +297,7 @@ static int html_parser_goto_script_end_tag(HtmlParser *self) { } } - if(self->text_stripped.size > 0) { + if(self->text.size > 0) { res = self->parse_callback(self, HTML_PARSE_JAVASCRIPT_CODE, self->callback_userdata); if(res != 0) return res; @@ -511,7 +511,7 @@ int html_parser_parse(const char *html_source, size_t len, HtmlParseCallback par } self.text.size = (self.source + self.offset) - self.text.data; strip(self.text.data, self.text.size, &self.text_stripped.data, &self.text_stripped.size, is_whitespace); - if(self.text_stripped.size > 0) { + if(self.text.size > 0) { res = self.parse_callback(&self, HTML_PARSE_TEXT, self.callback_userdata); if(res != 0) return res; -- cgit v1.2.3