Skip to content

Commit 17093ee

Browse files
committed
Fix <br> getting removed from the tree
1 parent 1f22d9f commit 17093ee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/html_parser.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,9 @@ class HtmlParser extends StatelessWidget {
888888
tree.children.forEach((child) {
889889
if (child is EmptyContentElement || child is EmptyLayoutElement) {
890890
toRemove.add(child);
891-
} else if (child is TextContentElement && (child.text!.trim().isEmpty)) {
891+
} else if (child is TextContentElement
892+
&& child.text!.trim().isEmpty
893+
&& child.style.whiteSpace != WhiteSpace.PRE) {
892894
toRemove.add(child);
893895
} else if (child is TextContentElement &&
894896
child.style.whiteSpace != WhiteSpace.PRE &&

0 commit comments

Comments
 (0)