autoclose void tags even if they're hidden - webdump - HTML to plain-text converter for webpages
HTML git clone git://git.codemadness.org/webdump
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 4e7948f981fb796b655b395b862293f1b0d58b75
DIR parent 7b9965a4903fd5857f38d78ad99f1b2ca02c9a5d
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 9 Sep 2026 23:02:50 +0200
autoclose void tags even if they're hidden
Reproducable:
<p>
<span>This should be visible.</span>
<img aria-hidden="true" src="bla">
<span>This should be visible also.</span>
</p>
Diffstat:
M webdump.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
DIR diff --git a/webdump.c b/webdump.c
@@ -2273,11 +2273,12 @@ xmltagstartparsed(XMLParser *p, const char *t, size_t tl, int isshort)
cur->tag.displaytype |= DisplayNone; /* else hide */
}
- if (cur->tag.displaytype & DisplayNone)
- return;
-
- if (reader_ignore)
+ if ((cur->tag.displaytype & DisplayNone) || reader_ignore) {
+ /* handle autoclosing void tags even if they're hidden */
+ if (!isshort && cur->tag.isvoid)
+ xmltagend(p, t, tl, 1); /* pretend close of short tag */
return;
+ }
indent = calcindent();