diff --git a/pkgs/html/CHANGELOG.md b/pkgs/html/CHANGELOG.md
index 9a881e9d78..86d7025830 100644
--- a/pkgs/html/CHANGELOG.md
+++ b/pkgs/html/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.15.5+1
+
+- Fix a bug in DOM parsing where `
` tags does not create a new line when html is converted to text.
+
## 0.15.5
- Require Dart `3.2`.
diff --git a/pkgs/html/lib/dom_parsing.dart b/pkgs/html/lib/dom_parsing.dart
index 69b0bbd4d0..540176878a 100644
--- a/pkgs/html/lib/dom_parsing.dart
+++ b/pkgs/html/lib/dom_parsing.dart
@@ -43,7 +43,14 @@ class TreeVisitor {
void visitText(Text node) => visitNodeFallback(node);
// TODO(jmesserly): visit attributes.
- void visitElement(Element node) => visitNodeFallback(node);
+ void visitElement(Element node) {
+ if (node.localName == 'br') {
+ visitText(Text('\n'));
+ return;
+ }
+
+ visitNodeFallback(node);
+ }
void visitComment(Comment node) => visitNodeFallback(node);
diff --git a/pkgs/html/pubspec.yaml b/pkgs/html/pubspec.yaml
index 447b98e186..7508588ad7 100644
--- a/pkgs/html/pubspec.yaml
+++ b/pkgs/html/pubspec.yaml
@@ -1,5 +1,5 @@
name: html
-version: 0.15.5
+version: 0.15.5+1
description: APIs for parsing and manipulating HTML content outside the browser.
repository: https://github.com/dart-lang/tools/tree/main/pkgs/html
issue_tracker: https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Ahtml
diff --git a/pkgs/html/test/parser_feature_test.dart b/pkgs/html/test/parser_feature_test.dart
index 7156146e02..d21ad375d0 100644
--- a/pkgs/html/test/parser_feature_test.dart
+++ b/pkgs/html/test/parser_feature_test.dart
@@ -265,11 +265,11 @@ On line 4, column 3 of ParseError: Unexpected DOCTYPE. Ignored.
});
test('Element.text', () {
- final doc = parseFragment('