Skip to content

Commit c50c468

Browse files
committed
Merge branch 'bugfix/796-empty-block-tags' into feature/release-213
2 parents f194ec4 + 5f93eab commit c50c468

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/html_parser.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,13 +944,17 @@ class HtmlParser extends StatelessWidget {
944944
if (child is EmptyContentElement || child is EmptyLayoutElement) {
945945
toRemove.add(child);
946946
} else if (child is TextContentElement
947-
&& child.text!.trim().isEmpty
947+
&& tree.name == "body"
948+
&& child.text!.trim().isEmpty) {
949+
toRemove.add(child);
950+
} else if (child is TextContentElement
951+
&& child.text!.isEmpty
948952
&& child.style.whiteSpace != WhiteSpace.PRE) {
949953
toRemove.add(child);
950954
} else if (child is TextContentElement &&
951955
child.style.whiteSpace != WhiteSpace.PRE &&
952956
tree.style.display == Display.BLOCK &&
953-
child.text!.trim().isEmpty &&
957+
child.text!.isEmpty &&
954958
lastChildBlock) {
955959
toRemove.add(child);
956960
} else if (child.style.display == Display.NONE) {

0 commit comments

Comments
 (0)