From 6f6bbb1828be2e191ff93546b938a7bb564fe5c7 Mon Sep 17 00:00:00 2001 From: Kunpei Sakai Date: Thu, 7 Nov 2019 01:53:51 +0900 Subject: [PATCH] html: add Dialog support Change-Id: I16afe71ca444afb03526f94e6743a587cd82a8d4 Reviewed-on: https://go-review.googlesource.com/c/net/+/205618 Run-TryBot: Kunpei Sakai TryBot-Result: Gobot Gobot Reviewed-by: Nigel Tao --- html/parse.go | 4 +- html/testdata/webkit/blocks.dat | 719 ++++++++++++++++++++++++++++++++ 2 files changed, 721 insertions(+), 2 deletions(-) create mode 100644 html/testdata/webkit/blocks.dat diff --git a/html/parse.go b/html/parse.go index 992cff2a..0ff15ff1 100644 --- a/html/parse.go +++ b/html/parse.go @@ -881,7 +881,7 @@ func inBodyIM(p *parser) bool { p.addElement() p.im = inFramesetIM return true - case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Menu, a.Nav, a.Ol, a.P, a.Section, a.Summary, a.Ul: + case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Menu, a.Nav, a.Ol, a.P, a.Section, a.Summary, a.Ul: p.popUntil(buttonScope, a.P) p.addElement() case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6: @@ -1137,7 +1137,7 @@ func inBodyIM(p *parser) bool { return false } return true - case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Menu, a.Nav, a.Ol, a.Pre, a.Section, a.Summary, a.Ul: + case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Menu, a.Nav, a.Ol, a.Pre, a.Section, a.Summary, a.Ul: p.popUntil(defaultScope, p.tok.DataAtom) case a.Form: if p.oe.contains(a.Template) { diff --git a/html/testdata/webkit/blocks.dat b/html/testdata/webkit/blocks.dat new file mode 100644 index 00000000..5d3871ea --- /dev/null +++ b/html/testdata/webkit/blocks.dat @@ -0,0 +1,719 @@ +#data +

foo

bar

baz +#errors +(1,39): expected-closing-tag-but-got-eof +30: Unclosed element “address”. +#document +| +| +| +| +|

+| "foo" +|

+| "bar" +|

+| "baz" + +#data +

foo

bar +#errors +#document +| +| +| +| +|
+|

+| "foo" +| "bar" + +#data +

foo

bar

baz +#errors +(1,39): expected-closing-tag-but-got-eof +30: Unclosed element “article”. +#document +| +| +| +| +|

+| "foo" +|

+| "bar" +|

+| "baz" + +#data +

foo

bar +#errors +#document +| +| +| +| +|
+|

+| "foo" +| "bar" + +#data +

foo