From 17093eef9f3f50b3eb593803f29c370d9c73b23f Mon Sep 17 00:00:00 2001 From: tanay Date: Sun, 30 May 2021 13:54:31 -0400 Subject: [PATCH] Fix
getting removed from the tree --- lib/html_parser.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/html_parser.dart b/lib/html_parser.dart index 562833981f..2b8d68f0f2 100644 --- a/lib/html_parser.dart +++ b/lib/html_parser.dart @@ -888,7 +888,9 @@ class HtmlParser extends StatelessWidget { tree.children.forEach((child) { if (child is EmptyContentElement || child is EmptyLayoutElement) { toRemove.add(child); - } else if (child is TextContentElement && (child.text!.trim().isEmpty)) { + } else if (child is TextContentElement + && child.text!.trim().isEmpty + && child.style.whiteSpace != WhiteSpace.PRE) { toRemove.add(child); } else if (child is TextContentElement && child.style.whiteSpace != WhiteSpace.PRE &&