Skip to content

Commit 22f17e9

Browse files
authored
Fix infinite loop with bad button close tag (flutter#128)
Closes flutter#122 Add 'button' to the tags that are processed with `endTagBlock`. The spec at https://html.spec.whatwg.org/multipage/parsing.html includes 'button' in the list of end tags with this treatment. Add a new `.dat` file for regression test. It include an `#info` field which is new but can be parsed safely to mark the issue for which it is a test. This test loops endlessly before the fix and passes after the fix. Note that since errors are currently untested and tests fail if they are tested the error will be left without content for now.
1 parent 2599afe commit 22f17e9

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.14.0+4
2+
3+
- Fix a bug parsing bad HTML where a 'button' end tag needs to close other
4+
elements.
5+
16
## 0.14.0+3
27

38
- Fix spans generated for HTML with higher-plane unicode characters

lib/parser.dart

+1
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,7 @@ class InBodyPhase extends Phase {
14121412
case 'article':
14131413
case 'aside':
14141414
case 'blockquote':
1415+
case 'button':
14151416
case 'center':
14161417
case 'details':
14171418
case 'dir':

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: html
2-
version: 0.14.0+3
2+
version: 0.14.0+4
33

44
description: APIs for parsing and manipulating HTML content outside the browser.
55
author: Dart Team <[email protected]>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#data
2+
<button><p></button><button></button>
3+
#info
4+
Regression test for https://github.com/dart-lang/html/issues/122
5+
#errors
6+
Errors are currently untested: https://github.com/dart-lang/html/issues/127
7+
#document
8+
| <html>
9+
| <head>
10+
| <body>
11+
| <button>
12+
| <p>
13+
| <button>

0 commit comments

Comments
 (0)