html: implement generic raw text element parsing algorithm

See: https://html.spec.whatwg.org/multipage/parsing.html#parsing-elements-that-contain-only-text

This follows up on golang.org/cl/205617

Change-Id: Id99054bc25e9ea90bb3f03b15c14c13573520997
Reviewed-on: https://go-review.googlesource.com/c/net/+/210318
Run-TryBot: Kunpei Sakai <namusyaka@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
diff --git a/html/parse.go b/html/parse.go
index 01b0aee..f21c29e 100644
--- a/html/parse.go
+++ b/html/parse.go
@@ -184,6 +184,17 @@
 	}
 }
 
+// parseGenericRawTextElements implements the generic raw text element parsing
+// algorithm defined in 12.2.6.2.
+// https://html.spec.whatwg.org/multipage/parsing.html#parsing-elements-that-contain-only-text
+// TODO: Since both RAWTEXT and RCDATA states are treated as tokenizer's part
+// officially, need to make tokenizer consider both states.
+func (p *parser) parseGenericRawTextElement() {
+	p.addElement()
+	p.originalIM = p.im
+	p.im = textIM
+}
+
 // generateImpliedEndTags pops nodes off the stack of open elements as long as
 // the top node has a tag name of dd, dt, li, optgroup, option, p, rb, rp, rt or rtc.
 // If exceptions are specified, nodes with that name will not be popped off.
@@ -631,19 +642,23 @@
 			p.acknowledgeSelfClosingTag()
 			return true
 		case a.Noscript:
-			p.addElement()
 			if p.scripting {
-				p.setOriginalIM()
-				p.im = textIM
-			} else {
-				p.im = inHeadNoscriptIM
+				p.parseGenericRawTextElement()
+				return true
 			}
+			p.addElement()
+			p.im = inHeadNoscriptIM
+			// Don't let the tokenizer go into raw text mode when scripting is disabled.
+			p.tokenizer.NextIsNotRawText()
 			return true
-		case a.Script, a.Title, a.Noframes, a.Style:
+		case a.Script, a.Title:
 			p.addElement()
 			p.setOriginalIM()
 			p.im = textIM
 			return true
+		case a.Noframes, a.Style:
+			p.parseGenericRawTextElement()
+			return true
 		case a.Head:
 			// Ignore the token.
 			return true
@@ -1023,18 +1038,21 @@
 			p.popUntil(buttonScope, a.P)
 			p.reconstructActiveFormattingElements()
 			p.framesetOK = false
-			p.addElement()
-			p.setOriginalIM()
-			p.im = textIM
+			p.parseGenericRawTextElement()
 		case a.Iframe:
 			p.framesetOK = false
+			p.parseGenericRawTextElement()
+		case a.Noembed:
+			p.parseGenericRawTextElement()
+		case a.Noscript:
+			if p.scripting {
+				p.parseGenericRawTextElement()
+				return true
+			}
+			p.reconstructActiveFormattingElements()
 			p.addElement()
-			p.setOriginalIM()
-			p.im = textIM
-		case a.Noembed, a.Noscript:
-			p.addElement()
-			p.setOriginalIM()
-			p.im = textIM
+			// Don't let the tokenizer go into raw text mode when scripting is disabled.
+			p.tokenizer.NextIsNotRawText()
 		case a.Select:
 			p.reconstructActiveFormattingElements()
 			p.addElement()
diff --git a/html/parse_test.go b/html/parse_test.go
index ee82de1..eb82288 100644
--- a/html/parse_test.go
+++ b/html/parse_test.go
@@ -272,7 +272,8 @@
 |   <head>
 |     <noscript>
 |   <body>
-|     "<img src='https://golang.org/doc/gopher/frontpage.png' />"
+|     <img>
+|       src="https://golang.org/doc/gopher/frontpage.png"
 |     <p>
 |       <img>
 |         src="https://golang.org/doc/gopher/doc.png"
diff --git a/html/testdata/webkit/tests16.dat b/html/testdata/webkit/tests16.dat
index c8ef66f..1219157 100644
--- a/html/testdata/webkit/tests16.dat
+++ b/html/testdata/webkit/tests16.dat
@@ -1,7 +1,7 @@
 #data
 <!doctype html><script>
 #errors
-Line: 1 Col: 23 Unexpected end of file. Expected end tag (script).
+(1,23): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -12,7 +12,7 @@
 #data
 <!doctype html><script>a
 #errors
-Line: 1 Col: 24 Unexpected end of file. Expected end tag (script).
+(1,24): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -24,7 +24,7 @@
 #data
 <!doctype html><script><
 #errors
-Line: 1 Col: 24 Unexpected end of file. Expected end tag (script).
+(1,24): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -36,7 +36,7 @@
 #data
 <!doctype html><script></
 #errors
-Line: 1 Col: 25 Unexpected end of file. Expected end tag (script).
+(1,25): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -48,7 +48,7 @@
 #data
 <!doctype html><script></S
 #errors
-Line: 1 Col: 26 Unexpected end of file. Expected end tag (script).
+(1,26): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -60,7 +60,7 @@
 #data
 <!doctype html><script></SC
 #errors
-Line: 1 Col: 27 Unexpected end of file. Expected end tag (script).
+(1,27): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -72,7 +72,7 @@
 #data
 <!doctype html><script></SCR
 #errors
-Line: 1 Col: 28 Unexpected end of file. Expected end tag (script).
+(1,28): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -84,7 +84,7 @@
 #data
 <!doctype html><script></SCRI
 #errors
-Line: 1 Col: 29 Unexpected end of file. Expected end tag (script).
+(1,29): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -96,7 +96,7 @@
 #data
 <!doctype html><script></SCRIP
 #errors
-Line: 1 Col: 30 Unexpected end of file. Expected end tag (script).
+(1,30): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -108,7 +108,7 @@
 #data
 <!doctype html><script></SCRIPT
 #errors
-Line: 1 Col: 31 Unexpected end of file. Expected end tag (script).
+(1,31): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -120,7 +120,8 @@
 #data
 <!doctype html><script></SCRIPT 
 #errors
-Line: 1 Col: 32 Unexpected end of file. Expected end tag (script).
+(1,32): expected-attribute-name-but-got-eof
+(1,32): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -131,7 +132,7 @@
 #data
 <!doctype html><script></s
 #errors
-Line: 1 Col: 26 Unexpected end of file. Expected end tag (script).
+(1,26): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -143,7 +144,7 @@
 #data
 <!doctype html><script></sc
 #errors
-Line: 1 Col: 27 Unexpected end of file. Expected end tag (script).
+(1,27): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -155,7 +156,7 @@
 #data
 <!doctype html><script></scr
 #errors
-Line: 1 Col: 28 Unexpected end of file. Expected end tag (script).
+(1,28): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -167,7 +168,7 @@
 #data
 <!doctype html><script></scri
 #errors
-Line: 1 Col: 29 Unexpected end of file. Expected end tag (script).
+(1,29): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -179,7 +180,7 @@
 #data
 <!doctype html><script></scrip
 #errors
-Line: 1 Col: 30 Unexpected end of file. Expected end tag (script).
+(1,30): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -191,7 +192,7 @@
 #data
 <!doctype html><script></script
 #errors
-Line: 1 Col: 31 Unexpected end of file. Expected end tag (script).
+(1,31): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -203,7 +204,8 @@
 #data
 <!doctype html><script></script 
 #errors
-Line: 1 Col: 32 Unexpected end of file. Expected end tag (script).
+(1,32): expected-attribute-name-but-got-eof
+(1,32): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -214,7 +216,7 @@
 #data
 <!doctype html><script><!
 #errors
-Line: 1 Col: 25 Unexpected end of file. Expected end tag (script).
+(1,25): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -226,7 +228,7 @@
 #data
 <!doctype html><script><!a
 #errors
-Line: 1 Col: 26 Unexpected end of file. Expected end tag (script).
+(1,26): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -238,7 +240,7 @@
 #data
 <!doctype html><script><!-
 #errors
-Line: 1 Col: 26 Unexpected end of file. Expected end tag (script).
+(1,26): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -250,7 +252,7 @@
 #data
 <!doctype html><script><!-a
 #errors
-Line: 1 Col: 27 Unexpected end of file. Expected end tag (script).
+(1,27): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -262,7 +264,8 @@
 #data
 <!doctype html><script><!--
 #errors
-Line: 1 Col: 27 Unexpected end of file. Expected end tag (script).
+(1,27): expected-named-closing-tag-but-got-eof
+(1,27): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -274,7 +277,8 @@
 #data
 <!doctype html><script><!--a
 #errors
-Line: 1 Col: 28 Unexpected end of file. Expected end tag (script).
+(1,28): expected-named-closing-tag-but-got-eof
+(1,28): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -286,7 +290,8 @@
 #data
 <!doctype html><script><!--<
 #errors
-Line: 1 Col: 28 Unexpected end of file. Expected end tag (script).
+(1,28): expected-named-closing-tag-but-got-eof
+(1,28): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -298,7 +303,8 @@
 #data
 <!doctype html><script><!--<a
 #errors
-Line: 1 Col: 29 Unexpected end of file. Expected end tag (script).
+(1,29): expected-named-closing-tag-but-got-eof
+(1,29): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -310,7 +316,8 @@
 #data
 <!doctype html><script><!--</
 #errors
-Line: 1 Col: 27 Unexpected end of file. Expected end tag (script).
+(1,29): expected-named-closing-tag-but-got-eof
+(1,29): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -322,7 +329,8 @@
 #data
 <!doctype html><script><!--</script
 #errors
-Line: 1 Col: 35 Unexpected end of file. Expected end tag (script).
+(1,35): expected-named-closing-tag-but-got-eof
+(1,35): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -334,7 +342,8 @@
 #data
 <!doctype html><script><!--</script 
 #errors
-Line: 1 Col: 36 Unexpected end of file. Expected end tag (script).
+(1,36): expected-attribute-name-but-got-eof
+(1,36): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -346,7 +355,8 @@
 #data
 <!doctype html><script><!--<s
 #errors
-Line: 1 Col: 29 Unexpected end of file. Expected end tag (script).
+(1,29): expected-named-closing-tag-but-got-eof
+(1,29): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -358,7 +368,8 @@
 #data
 <!doctype html><script><!--<script
 #errors
-Line: 1 Col: 34 Unexpected end of file. Expected end tag (script).
+(1,34): expected-named-closing-tag-but-got-eof
+(1,34): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -370,7 +381,8 @@
 #data
 <!doctype html><script><!--<script 
 #errors
-Line: 1 Col: 35 Unexpected end of file. Expected end tag (script).
+(1,35): eof-in-script-in-script
+(1,35): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -382,7 +394,8 @@
 #data
 <!doctype html><script><!--<script <
 #errors
-Line: 1 Col: 36 Unexpected end of file. Expected end tag (script).
+(1,36): eof-in-script-in-script
+(1,36): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -394,7 +407,8 @@
 #data
 <!doctype html><script><!--<script <a
 #errors
-Line: 1 Col: 37 Unexpected end of file. Expected end tag (script).
+(1,37): eof-in-script-in-script
+(1,37): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -406,7 +420,8 @@
 #data
 <!doctype html><script><!--<script </
 #errors
-Line: 1 Col: 37 Unexpected end of file. Expected end tag (script).
+(1,37): eof-in-script-in-script
+(1,37): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -418,7 +433,8 @@
 #data
 <!doctype html><script><!--<script </s
 #errors
-Line: 1 Col: 38 Unexpected end of file. Expected end tag (script).
+(1,38): eof-in-script-in-script
+(1,38): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -430,7 +446,8 @@
 #data
 <!doctype html><script><!--<script </script
 #errors
-Line: 1 Col: 43 Unexpected end of file. Expected end tag (script).
+(1,43): eof-in-script-in-script
+(1,43): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -442,7 +459,8 @@
 #data
 <!doctype html><script><!--<script </scripta
 #errors
-Line: 1 Col: 44 Unexpected end of file. Expected end tag (script).
+(1,44): eof-in-script-in-script
+(1,44): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -454,7 +472,8 @@
 #data
 <!doctype html><script><!--<script </script 
 #errors
-Line: 1 Col: 44 Unexpected end of file. Expected end tag (script).
+(1,44): expected-named-closing-tag-but-got-eof
+(1,44): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -466,7 +485,8 @@
 #data
 <!doctype html><script><!--<script </script>
 #errors
-Line: 1 Col: 44 Unexpected end of file. Expected end tag (script).
+(1,44): expected-named-closing-tag-but-got-eof
+(1,44): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -478,7 +498,8 @@
 #data
 <!doctype html><script><!--<script </script/
 #errors
-Line: 1 Col: 44 Unexpected end of file. Expected end tag (script).
+(1,44): expected-named-closing-tag-but-got-eof
+(1,44): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -490,7 +511,8 @@
 #data
 <!doctype html><script><!--<script </script <
 #errors
-Line: 1 Col: 45 Unexpected end of file. Expected end tag (script).
+(1,45): expected-named-closing-tag-but-got-eof
+(1,45): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -502,7 +524,8 @@
 #data
 <!doctype html><script><!--<script </script <a
 #errors
-Line: 1 Col: 46 Unexpected end of file. Expected end tag (script).
+(1,46): expected-named-closing-tag-but-got-eof
+(1,46): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -514,7 +537,8 @@
 #data
 <!doctype html><script><!--<script </script </
 #errors
-Line: 1 Col: 46 Unexpected end of file. Expected end tag (script).
+(1,46): expected-named-closing-tag-but-got-eof
+(1,46): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -526,7 +550,8 @@
 #data
 <!doctype html><script><!--<script </script </script
 #errors
-Line: 1 Col: 52 Unexpected end of file. Expected end tag (script).
+(1,52): expected-named-closing-tag-but-got-eof
+(1,52): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -538,7 +563,8 @@
 #data
 <!doctype html><script><!--<script </script </script 
 #errors
-Line: 1 Col: 53 Unexpected end of file. Expected end tag (script).
+(1,53): expected-attribute-name-but-got-eof
+(1,53): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -550,7 +576,8 @@
 #data
 <!doctype html><script><!--<script </script </script/
 #errors
-Line: 1 Col: 53 Unexpected end of file. Expected end tag (script).
+(1,53): unexpected-EOF-after-solidus-in-tag
+(1,53): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -573,7 +600,8 @@
 #data
 <!doctype html><script><!--<script -
 #errors
-Line: 1 Col: 36 Unexpected end of file. Expected end tag (script).
+(1,36): eof-in-script-in-script
+(1,36): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -585,7 +613,8 @@
 #data
 <!doctype html><script><!--<script -a
 #errors
-Line: 1 Col: 37 Unexpected end of file. Expected end tag (script).
+(1,37): eof-in-script-in-script
+(1,37): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -597,7 +626,8 @@
 #data
 <!doctype html><script><!--<script -<
 #errors
-Line: 1 Col: 37 Unexpected end of file. Expected end tag (script).
+(1,37): eof-in-script-in-script
+(1,37): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -609,7 +639,8 @@
 #data
 <!doctype html><script><!--<script --
 #errors
-Line: 1 Col: 37 Unexpected end of file. Expected end tag (script).
+(1,37): eof-in-script-in-script
+(1,37): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -621,7 +652,8 @@
 #data
 <!doctype html><script><!--<script --a
 #errors
-Line: 1 Col: 38 Unexpected end of file. Expected end tag (script).
+(1,38): eof-in-script-in-script
+(1,38): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -633,7 +665,8 @@
 #data
 <!doctype html><script><!--<script --<
 #errors
-Line: 1 Col: 38 Unexpected end of file. Expected end tag (script).
+(1,38): eof-in-script-in-script
+(1,38): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -645,7 +678,7 @@
 #data
 <!doctype html><script><!--<script -->
 #errors
-Line: 1 Col: 38 Unexpected end of file. Expected end tag (script).
+(1,38): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -657,7 +690,7 @@
 #data
 <!doctype html><script><!--<script --><
 #errors
-Line: 1 Col: 39 Unexpected end of file. Expected end tag (script).
+(1,39): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -669,7 +702,7 @@
 #data
 <!doctype html><script><!--<script --></
 #errors
-Line: 1 Col: 40 Unexpected end of file. Expected end tag (script).
+(1,40): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -681,7 +714,7 @@
 #data
 <!doctype html><script><!--<script --></script
 #errors
-Line: 1 Col: 46 Unexpected end of file. Expected end tag (script).
+(1,46): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -693,7 +726,8 @@
 #data
 <!doctype html><script><!--<script --></script 
 #errors
-Line: 1 Col: 47 Unexpected end of file. Expected end tag (script).
+(1,47): expected-attribute-name-but-got-eof
+(1,47): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -705,7 +739,8 @@
 #data
 <!doctype html><script><!--<script --></script/
 #errors
-Line: 1 Col: 47 Unexpected end of file. Expected end tag (script).
+(1,47): unexpected-EOF-after-solidus-in-tag
+(1,47): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -816,7 +851,8 @@
 #data
 <!doctype html><script><!--<script>--!></script>X
 #errors
-Line: 1 Col: 49 Unexpected end of file. Expected end tag (script).
+(1,49): expected-named-closing-tag-but-got-eof
+(1,49): unexpected-EOF-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -828,7 +864,7 @@
 #data
 <!doctype html><script><!--<scr'+'ipt></script>--></script>
 #errors
-Line: 1 Col: 59 Unexpected end tag (script).
+(1,59): unexpected-end-tag
 #document
 | <!DOCTYPE html>
 | <html>
@@ -841,7 +877,8 @@
 #data
 <!doctype html><script><!--<script></scr'+'ipt></script>X
 #errors
-Line: 1 Col: 57 Unexpected end of file. Expected end tag (script).
+(1,57): expected-named-closing-tag-but-got-eof
+(1,57): unexpected-eof-in-text-mode
 #document
 | <!DOCTYPE html>
 | <html>
@@ -853,7 +890,7 @@
 #data
 <!doctype html><style><!--<style></style>--></style>
 #errors
-Line: 1 Col: 52 Unexpected end tag (style).
+(1,52): unexpected-end-tag
 #document
 | <!DOCTYPE html>
 | <html>
@@ -878,7 +915,7 @@
 #data
 <!doctype html><style><!--...</style>...--></style>
 #errors
-Line: 1 Col: 51 Unexpected end tag (style).
+(1,51): unexpected-end-tag
 #document
 | <!DOCTYPE html>
 | <html>
@@ -903,7 +940,7 @@
 #data
 <!doctype html><style><!--...<style><!--...--!></style>--></style>
 #errors
-Line: 1 Col: 66 Unexpected end tag (style).
+(1,66): unexpected-end-tag
 #document
 | <!DOCTYPE html>
 | <html>
@@ -930,7 +967,7 @@
 #data
 <!doctype html><style>...<style><!--...</style><!-- --></style>
 #errors
-Line: 1 Col: 63 Unexpected end tag (style).
+(1,63): unexpected-end-tag
 #document
 | <!DOCTYPE html>
 | <html>
@@ -955,7 +992,7 @@
 #data
 <!doctype html><title><!--<title></title>--></title>
 #errors
-Line: 1 Col: 52 Unexpected end tag (title).
+(1,52): unexpected-end-tag
 #document
 | <!DOCTYPE html>
 | <html>
@@ -979,7 +1016,7 @@
 #data
 <!doctype html><title>foo/title><link></head><body>X
 #errors
-Line: 1 Col: 52 Unexpected end of file. Expected end tag (title).
+(1,52): expected-named-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -991,7 +1028,8 @@
 #data
 <!doctype html><noscript><!--<noscript></noscript>--></noscript>
 #errors
-Line: 1 Col: 64 Unexpected end tag (noscript).
+(1,64): unexpected-end-tag
+#script-on
 #document
 | <!DOCTYPE html>
 | <html>
@@ -1002,8 +1040,21 @@
 |     "-->"
 
 #data
+<!doctype html><noscript><!--<noscript></noscript>--></noscript>
+#errors
+#script-off
+#document
+| <!DOCTYPE html>
+| <html>
+|   <head>
+|     <noscript>
+|       <!-- <noscript></noscript> -->
+|   <body>
+
+#data
 <!doctype html><noscript><!--</noscript>X<noscript>--></noscript>
 #errors
+#script-on
 #document
 | <!DOCTYPE html>
 | <html>
@@ -1016,8 +1067,21 @@
 |       "-->"
 
 #data
+<!doctype html><noscript><!--</noscript>X<noscript>--></noscript>
+#errors
+#script-off
+#document
+| <!DOCTYPE html>
+| <html>
+|   <head>
+|     <noscript>
+|       <!-- </noscript>X<noscript> -->
+|   <body>
+
+#data
 <!doctype html><noscript><iframe></noscript>X
 #errors
+#script-on
 #document
 | <!DOCTYPE html>
 | <html>
@@ -1028,9 +1092,24 @@
 |     "X"
 
 #data
+<!doctype html><noscript><iframe></noscript>X
+#errors
+ * (1,34) unexpected token in head noscript
+ * (1,46) unexpected EOF
+#script-off
+#document
+| <!DOCTYPE html>
+| <html>
+|   <head>
+|     <noscript>
+|   <body>
+|     <iframe>
+|       "</noscript>X"
+
+#data
 <!doctype html><noframes><!--<noframes></noframes>--></noframes>
 #errors
-Line: 1 Col: 64 Unexpected end tag (noframes).
+(1,64): unexpected-end-tag
 #document
 | <!DOCTYPE html>
 | <html>
@@ -1054,7 +1133,7 @@
 #data
 <!doctype html><textarea><!--<textarea></textarea>--></textarea>
 #errors
-Line: 1 Col: 64 Unexpected end tag (textarea).
+(1,64): unexpected-end-tag
 #document
 | <!DOCTYPE html>
 | <html>
@@ -1100,7 +1179,7 @@
 #data
 <!doctype html><iframe><!--<iframe></iframe>--></iframe>
 #errors
-Line: 1 Col: 56 Unexpected end tag (iframe).
+(1,56): unexpected-end-tag
 #document
 | <!DOCTYPE html>
 | <html>
@@ -1124,7 +1203,7 @@
 #data
 <!doctype html><xmp><!--<xmp></xmp>--></xmp>
 #errors
-Line: 1 Col: 44 Unexpected end tag (xmp).
+(1,44): unexpected-end-tag
 #document
 | <!DOCTYPE html>
 | <html>
@@ -1137,7 +1216,7 @@
 #data
 <!doctype html><noembed><!--<noembed></noembed>--></noembed>
 #errors
-Line: 1 Col: 60 Unexpected end tag (noembed).
+(1,60): unexpected-end-tag
 #document
 | <!DOCTYPE html>
 | <html>
@@ -1150,8 +1229,8 @@
 #data
 <script>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 8 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,8): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1161,8 +1240,8 @@
 #data
 <script>a
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 9 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,9): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1173,8 +1252,8 @@
 #data
 <script><
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 9 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,9): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1185,8 +1264,8 @@
 #data
 <script></
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 10 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,10): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1197,8 +1276,8 @@
 #data
 <script></S
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 11 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,11): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1209,8 +1288,8 @@
 #data
 <script></SC
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 12 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,12): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1221,8 +1300,8 @@
 #data
 <script></SCR
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 13 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,13): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1233,8 +1312,8 @@
 #data
 <script></SCRI
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 14 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,14): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1245,8 +1324,8 @@
 #data
 <script></SCRIP
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 15 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,15): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1257,8 +1336,8 @@
 #data
 <script></SCRIPT
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 16 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,16): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1269,8 +1348,9 @@
 #data
 <script></SCRIPT 
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 17 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,17): expected-attribute-name-but-got-eof
+(1,17): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1280,8 +1360,8 @@
 #data
 <script></s
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 11 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,11): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1292,8 +1372,8 @@
 #data
 <script></sc
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 12 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,12): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1304,8 +1384,8 @@
 #data
 <script></scr
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 13 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,13): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1316,8 +1396,8 @@
 #data
 <script></scri
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 14 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,14): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1328,8 +1408,8 @@
 #data
 <script></scrip
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 15 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,15): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1340,8 +1420,8 @@
 #data
 <script></script
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 16 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,16): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1352,8 +1432,9 @@
 #data
 <script></script 
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 17 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,17): expected-attribute-name-but-got-eof
+(1,17): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1363,8 +1444,8 @@
 #data
 <script><!
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 10 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,10): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1375,8 +1456,8 @@
 #data
 <script><!a
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 11 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,11): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1387,8 +1468,8 @@
 #data
 <script><!-
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 11 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,11): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1399,8 +1480,8 @@
 #data
 <script><!-a
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 12 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,12): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1411,8 +1492,9 @@
 #data
 <script><!--
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 12 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,12): expected-named-closing-tag-but-got-eof
+(1,12): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1423,8 +1505,9 @@
 #data
 <script><!--a
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 13 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,13): expected-named-closing-tag-but-got-eof
+(1,13): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1435,8 +1518,9 @@
 #data
 <script><!--<
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 13 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,13): expected-named-closing-tag-but-got-eof
+(1,13): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1447,8 +1531,9 @@
 #data
 <script><!--<a
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 14 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,14): expected-named-closing-tag-but-got-eof
+(1,14): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1459,8 +1544,9 @@
 #data
 <script><!--</
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 14 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,14): expected-named-closing-tag-but-got-eof
+(1,14): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1471,8 +1557,9 @@
 #data
 <script><!--</script
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 20 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,20): expected-named-closing-tag-but-got-eof
+(1,20): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1483,8 +1570,9 @@
 #data
 <script><!--</script 
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 21 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,21): expected-attribute-name-but-got-eof
+(1,21): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1495,8 +1583,9 @@
 #data
 <script><!--<s
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 14 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,14): expected-named-closing-tag-but-got-eof
+(1,14): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1507,8 +1596,9 @@
 #data
 <script><!--<script
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 19 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,19): expected-named-closing-tag-but-got-eof
+(1,19): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1519,8 +1609,9 @@
 #data
 <script><!--<script 
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 20 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,20): eof-in-script-in-script
+(1,20): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1531,8 +1622,9 @@
 #data
 <script><!--<script <
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 21 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,21): eof-in-script-in-script
+(1,21): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1543,8 +1635,9 @@
 #data
 <script><!--<script <a
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 22 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,22): eof-in-script-in-script
+(1,22): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1555,8 +1648,9 @@
 #data
 <script><!--<script </
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 22 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,22): eof-in-script-in-script
+(1,22): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1567,8 +1661,9 @@
 #data
 <script><!--<script </s
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 23 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,23): eof-in-script-in-script
+(1,23): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1579,8 +1674,9 @@
 #data
 <script><!--<script </script
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 28 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,28): eof-in-script-in-script
+(1,28): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1591,8 +1687,9 @@
 #data
 <script><!--<script </scripta
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 29 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,29): eof-in-script-in-script
+(1,29): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1603,8 +1700,9 @@
 #data
 <script><!--<script </script 
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 29 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,29): expected-named-closing-tag-but-got-eof
+(1,29): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1615,8 +1713,9 @@
 #data
 <script><!--<script </script>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 29 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,29): expected-named-closing-tag-but-got-eof
+(1,29): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1627,8 +1726,9 @@
 #data
 <script><!--<script </script/
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 29 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,29): expected-named-closing-tag-but-got-eof
+(1,29): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1639,8 +1739,9 @@
 #data
 <script><!--<script </script <
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 30 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,30): expected-named-closing-tag-but-got-eof
+(1,30): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1651,8 +1752,9 @@
 #data
 <script><!--<script </script <a
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 31 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,31): expected-named-closing-tag-but-got-eof
+(1,31): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1663,8 +1765,9 @@
 #data
 <script><!--<script </script </
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 31 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,31): expected-named-closing-tag-but-got-eof
+(1,31): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1675,8 +1778,9 @@
 #data
 <script><!--<script </script </script
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 38 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,37): expected-named-closing-tag-but-got-eof
+(1,37): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1687,8 +1791,9 @@
 #data
 <script><!--<script </script </script 
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 38 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,38): expected-attribute-name-but-got-eof
+(1,38): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1699,8 +1804,9 @@
 #data
 <script><!--<script </script </script/
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 38 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,38): unexpected-EOF-after-solidus-in-tag
+(1,38): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1711,7 +1817,7 @@
 #data
 <script><!--<script </script </script>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -1722,8 +1828,9 @@
 #data
 <script><!--<script -
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 21 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,21): eof-in-script-in-script
+(1,21): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1734,8 +1841,9 @@
 #data
 <script><!--<script -a
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 22 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,22): eof-in-script-in-script
+(1,22): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1746,8 +1854,9 @@
 #data
 <script><!--<script --
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 22 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,22): eof-in-script-in-script
+(1,22): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1758,8 +1867,9 @@
 #data
 <script><!--<script --a
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 23 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,23): eof-in-script-in-script
+(1,23): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1770,8 +1880,8 @@
 #data
 <script><!--<script -->
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 23 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,23): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1782,8 +1892,8 @@
 #data
 <script><!--<script --><
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 24 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,24): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1794,8 +1904,8 @@
 #data
 <script><!--<script --></
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 25 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,25): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1806,8 +1916,8 @@
 #data
 <script><!--<script --></script
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 31 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,31): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1818,8 +1928,9 @@
 #data
 <script><!--<script --></script 
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 32 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,32): expected-attribute-name-but-got-eof
+(1,32): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1830,8 +1941,9 @@
 #data
 <script><!--<script --></script/
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 32 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,32): unexpected-EOF-after-solidus-in-tag
+(1,32): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -1842,7 +1954,7 @@
 #data
 <script><!--<script --></script>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -1853,7 +1965,7 @@
 #data
 <script><!--<script><\/script>--></script>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -1864,7 +1976,7 @@
 #data
 <script><!--<script></scr'+'ipt>--></script>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -1875,7 +1987,7 @@
 #data
 <script><!--<script></script><script></script></script>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -1886,7 +1998,7 @@
 #data
 <script><!--<script></script><script></script>--><!--</script>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -1897,7 +2009,7 @@
 #data
 <script><!--<script></script><script></script>-- ></script>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -1908,7 +2020,7 @@
 #data
 <script><!--<script></script><script></script>- -></script>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -1919,7 +2031,7 @@
 #data
 <script><!--<script></script><script></script>- - ></script>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -1930,7 +2042,7 @@
 #data
 <script><!--<script></script><script></script>-></script>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -1941,8 +2053,9 @@
 #data
 <script><!--<script>--!></script>X
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 34 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,34): expected-named-closing-tag-but-got-eof
+(1,34): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1953,8 +2066,8 @@
 #data
 <script><!--<scr'+'ipt></script>--></script>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 44 Unexpected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,44): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -1966,8 +2079,9 @@
 #data
 <script><!--<script></scr'+'ipt></script>X
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 42 Unexpected end of file. Expected end tag (script).
+(1,8): expected-doctype-but-got-start-tag
+(1,42): expected-named-closing-tag-but-got-eof
+(1,42): unexpected-eof-in-text-mode
 #document
 | <html>
 |   <head>
@@ -1978,8 +2092,8 @@
 #data
 <style><!--<style></style>--></style>
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
-Line: 1 Col: 37 Unexpected end tag (style).
+(1,7): expected-doctype-but-got-start-tag
+(1,37): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -1991,7 +2105,7 @@
 #data
 <style><!--</style>X
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
+(1,7): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -2003,8 +2117,8 @@
 #data
 <style><!--...</style>...--></style>
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
-Line: 1 Col: 36 Unexpected end tag (style).
+(1,7): expected-doctype-but-got-start-tag
+(1,36): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -2016,7 +2130,7 @@
 #data
 <style><!--<br><html xmlns:v="urn:schemas-microsoft-com:vml"><!--[if !mso]><style></style>X
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
+(1,7): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -2028,8 +2142,8 @@
 #data
 <style><!--...<style><!--...--!></style>--></style>
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
-Line: 1 Col: 51 Unexpected end tag (style).
+(1,7): expected-doctype-but-got-start-tag
+(1,51): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -2041,7 +2155,7 @@
 #data
 <style><!--...</style><!-- --><style>@import ...</style>
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
+(1,7): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -2055,8 +2169,8 @@
 #data
 <style>...<style><!--...</style><!-- --></style>
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
-Line: 1 Col: 48 Unexpected end tag (style).
+(1,7): expected-doctype-but-got-start-tag
+(1,48): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -2068,7 +2182,7 @@
 #data
 <style>...<!--[if IE]><style>...</style>X
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
+(1,7): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -2080,8 +2194,8 @@
 #data
 <title><!--<title></title>--></title>
 #errors
-Line: 1 Col: 7 Unexpected start tag (title). Expected DOCTYPE.
-Line: 1 Col: 37 Unexpected end tag (title).
+(1,7): expected-doctype-but-got-start-tag
+(1,37): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -2093,7 +2207,7 @@
 #data
 <title>&lt;/title></title>
 #errors
-Line: 1 Col: 7 Unexpected start tag (title). Expected DOCTYPE.
+(1,7): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -2104,8 +2218,8 @@
 #data
 <title>foo/title><link></head><body>X
 #errors
-Line: 1 Col: 7 Unexpected start tag (title). Expected DOCTYPE.
-Line: 1 Col: 37 Unexpected end of file. Expected end tag (title).
+(1,7): expected-doctype-but-got-start-tag
+(1,37): expected-named-closing-tag-but-got-eof
 #document
 | <html>
 |   <head>
@@ -2116,8 +2230,9 @@
 #data
 <noscript><!--<noscript></noscript>--></noscript>
 #errors
-Line: 1 Col: 10 Unexpected start tag (noscript). Expected DOCTYPE.
-Line: 1 Col: 49 Unexpected end tag (noscript).
+(1,10): expected-doctype-but-got-start-tag
+(1,49): unexpected-end-tag
+#script-on
 #document
 | <html>
 |   <head>
@@ -2127,9 +2242,22 @@
 |     "-->"
 
 #data
+<noscript><!--<noscript></noscript>--></noscript>
+#errors
+ * (1,11) missing DOCTYPE
+#script-off
+#document
+| <html>
+|   <head>
+|     <noscript>
+|       <!-- <noscript></noscript> -->
+|   <body>
+
+#data
 <noscript><!--</noscript>X<noscript>--></noscript>
 #errors
-Line: 1 Col: 10 Unexpected start tag (noscript). Expected DOCTYPE.
+(1,10): expected-doctype-but-got-start-tag
+#script-on
 #document
 | <html>
 |   <head>
@@ -2141,9 +2269,22 @@
 |       "-->"
 
 #data
+<noscript><!--</noscript>X<noscript>--></noscript>
+#errors
+(1,10): expected-doctype-but-got-start-tag
+#script-off
+#document
+| <html>
+|   <head>
+|     <noscript>
+|       <!-- </noscript>X<noscript> -->
+|   <body>
+
+#data
 <noscript><iframe></noscript>X
 #errors
-Line: 1 Col: 10 Unexpected start tag (noscript). Expected DOCTYPE.
+(1,10): expected-doctype-but-got-start-tag
+#script-on
 #document
 | <html>
 |   <head>
@@ -2153,10 +2294,25 @@
 |     "X"
 
 #data
+<noscript><iframe></noscript>X
+#errors
+ * (1,11) missing DOCTYPE
+ * (1,19) unexpected token in head noscript
+ * (1,31) unexpected EOF
+#script-off
+#document
+| <html>
+|   <head>
+|     <noscript>
+|   <body>
+|     <iframe>
+|       "</noscript>X"
+
+#data
 <noframes><!--<noframes></noframes>--></noframes>
 #errors
-Line: 1 Col: 10 Unexpected start tag (noframes). Expected DOCTYPE.
-Line: 1 Col: 49 Unexpected end tag (noframes).
+(1,10): expected-doctype-but-got-start-tag
+(1,49): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -2168,7 +2324,7 @@
 #data
 <noframes><body><script><!--...</script></body></noframes></html>
 #errors
-Line: 1 Col: 10 Unexpected start tag (noframes). Expected DOCTYPE.
+(1,10): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -2179,8 +2335,8 @@
 #data
 <textarea><!--<textarea></textarea>--></textarea>
 #errors
-Line: 1 Col: 10 Unexpected start tag (textarea). Expected DOCTYPE.
-Line: 1 Col: 49 Unexpected end tag (textarea).
+(1,10): expected-doctype-but-got-start-tag
+(1,49): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -2192,7 +2348,7 @@
 #data
 <textarea>&lt;/textarea></textarea>
 #errors
-Line: 1 Col: 10 Unexpected start tag (textarea). Expected DOCTYPE.
+(1,10): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -2203,8 +2359,8 @@
 #data
 <iframe><!--<iframe></iframe>--></iframe>
 #errors
-Line: 1 Col: 8 Unexpected start tag (iframe). Expected DOCTYPE.
-Line: 1 Col: 41 Unexpected end tag (iframe).
+(1,8): expected-doctype-but-got-start-tag
+(1,41): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -2216,7 +2372,7 @@
 #data
 <iframe>...<!--X->...<!--/X->...</iframe>
 #errors
-Line: 1 Col: 8 Unexpected start tag (iframe). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -2227,8 +2383,8 @@
 #data
 <xmp><!--<xmp></xmp>--></xmp>
 #errors
-Line: 1 Col: 5 Unexpected start tag (xmp). Expected DOCTYPE.
-Line: 1 Col: 29 Unexpected end tag (xmp).
+(1,5): expected-doctype-but-got-start-tag
+(1,29): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -2240,8 +2396,8 @@
 #data
 <noembed><!--<noembed></noembed>--></noembed>
 #errors
-Line: 1 Col: 9 Unexpected start tag (noembed). Expected DOCTYPE.
-Line: 1 Col: 45 Unexpected end tag (noembed).
+(1,9): expected-doctype-but-got-start-tag
+(1,45): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -2254,7 +2410,7 @@
 <!doctype html><table>
 
 #errors
-Line 2 Col 0 Unexpected end of file. Expected table content.
+(2,0): eof-in-table
 #document
 | <!DOCTYPE html>
 | <html>
@@ -2267,9 +2423,9 @@
 #data
 <!doctype html><table><td><span><font></span><span>
 #errors
-Line 1 Col 26 Unexpected table cell start tag (td) in the table body phase.
-Line 1 Col 45 Unexpected end tag (span).
-Line 1 Col 51 Expected closing tag. Unexpected end of file.
+(1,26): unexpected-cell-in-table-body
+(1,45): unexpected-end-tag
+(1,51): expected-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
@@ -2287,8 +2443,11 @@
 #data
 <!doctype html><form><table></form><form></table></form>
 #errors
-35: Stray end tag “form”.
-41: Start tag “form” seen in “table”.
+(1,35): unexpected-end-tag-implies-table-voodoo
+(1,35): unexpected-end-tag
+(1,41): unexpected-form-in-table
+(1,56): unexpected-end-tag
+(1,56): expected-closing-tag-but-got-eof
 #document
 | <!DOCTYPE html>
 | <html>
diff --git a/html/testdata/webkit/tests5.dat b/html/testdata/webkit/tests5.dat
index d7b5128..1ef8cae 100644
--- a/html/testdata/webkit/tests5.dat
+++ b/html/testdata/webkit/tests5.dat
@@ -1,8 +1,7 @@
 #data
 <style> <!-- </style>x
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
-Line: 1 Col: 22 Unexpected end of file. Expected end tag (style).
+(1,7): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -14,7 +13,8 @@
 #data
 <style> <!-- </style> --> </style>x
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
+(1,7): expected-doctype-but-got-start-tag
+(1,34): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -27,7 +27,7 @@
 #data
 <style> <!--> </style>x
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
+(1,7): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -39,7 +39,7 @@
 #data
 <style> <!---> </style>x
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
+(1,7): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -51,7 +51,7 @@
 #data
 <iframe> <!---> </iframe>x
 #errors
-Line: 1 Col: 8 Unexpected start tag (iframe). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -63,7 +63,9 @@
 #data
 <iframe> <!--- </iframe>->x</iframe> --> </iframe>x
 #errors
-Line: 1 Col: 8 Unexpected start tag (iframe). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
+(1,36): unexpected-end-tag
+(1,50): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -75,7 +77,8 @@
 #data
 <script> <!-- </script> --> </script>x
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
+(1,8): expected-doctype-but-got-start-tag
+(1,37): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -88,7 +91,8 @@
 #data
 <title> <!-- </title> --> </title>x
 #errors
-Line: 1 Col: 7 Unexpected start tag (title). Expected DOCTYPE.
+(1,7): expected-doctype-but-got-start-tag
+(1,34): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -101,7 +105,9 @@
 #data
 <textarea> <!--- </textarea>->x</textarea> --> </textarea>x
 #errors
-Line: 1 Col: 10 Unexpected start tag (textarea). Expected DOCTYPE.
+(1,10): expected-doctype-but-got-start-tag
+(1,42): unexpected-end-tag
+(1,58): unexpected-end-tag
 #document
 | <html>
 |   <head>
@@ -113,7 +119,7 @@
 #data
 <style> <!</-- </style>x
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
+(1,7): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -125,7 +131,7 @@
 #data
 <p><xmp></xmp>
 #errors
-XXX: Unknown
+(1,3): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -136,7 +142,7 @@
 #data
 <xmp> <!-- > --> </xmp>
 #errors
-Line: 1 Col: 5 Unexpected start tag (xmp). Expected DOCTYPE.
+(1,5): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -147,7 +153,7 @@
 #data
 <title>&amp;</title>
 #errors
-Line: 1 Col: 7 Unexpected start tag (title). Expected DOCTYPE.
+(1,7): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -158,7 +164,7 @@
 #data
 <title><!--&amp;--></title>
 #errors
-Line: 1 Col: 7 Unexpected start tag (title). Expected DOCTYPE.
+(1,7): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -169,8 +175,7 @@
 #data
 <title><!--</title>
 #errors
-Line: 1 Col: 7 Unexpected start tag (title). Expected DOCTYPE.
-Line: 1 Col: 19 Unexpected end of file. Expected end tag (title).
+(1,7): expected-doctype-but-got-start-tag
 #document
 | <html>
 |   <head>
@@ -181,7 +186,9 @@
 #data
 <noscript><!--</noscript>--></noscript>
 #errors
-Line: 1 Col: 10 Unexpected start tag (noscript). Expected DOCTYPE.
+(1,10): expected-doctype-but-got-start-tag
+(1,39): unexpected-end-tag
+#script-on
 #document
 | <html>
 |   <head>
@@ -189,3 +196,15 @@
 |       "<!--"
 |   <body>
 |     "-->"
+
+#data
+<noscript><!--</noscript>--></noscript>
+#errors
+(1,10): expected-doctype-but-got-start-tag
+#script-off
+#document
+| <html>
+|   <head>
+|     <noscript>
+|       <!-- </noscript> -->
+|   <body>
diff --git a/html/testdata/webkit/webkit02.dat b/html/testdata/webkit/webkit02.dat
index 0f8efb1..68dad85 100644
--- a/html/testdata/webkit/webkit02.dat
+++ b/html/testdata/webkit/webkit02.dat
@@ -27,6 +27,23 @@
 |         "B"
 
 #data
+<p id="status"><noscript><strong>A</strong></noscript><span>B</span></p>
+#errors
+(1,15): expected-doctype-but-got-start-tag
+#script-off
+#document
+| <html>
+|   <head>
+|   <body>
+|     <p>
+|       id="status"
+|       <noscript>
+|         <strong>
+|           "A"
+|       <span>
+|         "B"
+
+#data
 <div><sarcasm><div></div></sarcasm></div>
 #errors
 (1,5): expected-doctype-but-got-start-tag
@@ -137,6 +154,52 @@
 |     <table>
 
 #data
+<b><em><foo><foo><aside></b>
+#errors
+#document
+| <html>
+|   <head>
+|   <body>
+|     <b>
+|       <em>
+|         <foo>
+|           <foo>
+|     <em>
+|       <aside>
+|         <b>
+
+#data
+<b><em><foo><foo><aside></b></em>
+#errors
+#document
+| <html>
+|   <head>
+|   <body>
+|     <b>
+|       <em>
+|         <foo>
+|           <foo>
+|     <em>
+|     <aside>
+|       <em>
+|         <b>
+
+#data
+<b><em><foo><foo><foo><aside></b>
+#errors
+#document
+| <html>
+|   <head>
+|   <body>
+|     <b>
+|       <em>
+|         <foo>
+|           <foo>
+|             <foo>
+|     <aside>
+|       <b>
+
+#data
 <b><em><dcell><postfield><postfield><postfield><postfield><missing_glyph><missing_glyph><missing_glyph><missing_glyph><hkern><aside></b></em>
 #errors
 #document-fragment