aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/golang.org/x/net/html/const.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/net/html/const.go')
-rw-r--r--vendor/golang.org/x/net/html/const.go102
1 files changed, 102 insertions, 0 deletions
diff --git a/vendor/golang.org/x/net/html/const.go b/vendor/golang.org/x/net/html/const.go
new file mode 100644
index 0000000..52f651f
--- /dev/null
+++ b/vendor/golang.org/x/net/html/const.go
@@ -0,0 +1,102 @@
1// Copyright 2011 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package html
6
7// Section 12.2.3.2 of the HTML5 specification says "The following elements
8// have varying levels of special parsing rules".
9// https://html.spec.whatwg.org/multipage/syntax.html#the-stack-of-open-elements
10var isSpecialElementMap = map[string]bool{
11 "address": true,
12 "applet": true,
13 "area": true,
14 "article": true,
15 "aside": true,
16 "base": true,
17 "basefont": true,
18 "bgsound": true,
19 "blockquote": true,
20 "body": true,
21 "br": true,
22 "button": true,
23 "caption": true,
24 "center": true,
25 "col": true,
26 "colgroup": true,
27 "dd": true,
28 "details": true,
29 "dir": true,
30 "div": true,
31 "dl": true,
32 "dt": true,
33 "embed": true,
34 "fieldset": true,
35 "figcaption": true,
36 "figure": true,
37 "footer": true,
38 "form": true,
39 "frame": true,
40 "frameset": true,
41 "h1": true,
42 "h2": true,
43 "h3": true,
44 "h4": true,
45 "h5": true,
46 "h6": true,
47 "head": true,
48 "header": true,
49 "hgroup": true,
50 "hr": true,
51 "html": true,
52 "iframe": true,
53 "img": true,
54 "input": true,
55 "isindex": true,
56 "li": true,
57 "link": true,
58 "listing": true,
59 "marquee": true,
60 "menu": true,
61 "meta": true,
62 "nav": true,
63 "noembed": true,
64 "noframes": true,
65 "noscript": true,
66 "object": true,
67 "ol": true,
68 "p": true,
69 "param": true,
70 "plaintext": true,
71 "pre": true,
72 "script": true,
73 "section": true,
74 "select": true,
75 "source": true,
76 "style": true,
77 "summary": true,
78 "table": true,
79 "tbody": true,
80 "td": true,
81 "template": true,
82 "textarea": true,
83 "tfoot": true,
84 "th": true,
85 "thead": true,
86 "title": true,
87 "tr": true,
88 "track": true,
89 "ul": true,
90 "wbr": true,
91 "xmp": true,
92}
93
94func isSpecialElement(element *Node) bool {
95 switch element.Namespace {
96 case "", "html":
97 return isSpecialElementMap[element.Data]
98 case "svg":
99 return element.Data == "foreignObject"
100 }
101 return false
102}