9878eca6eff15a5e99c2888f46d6a68d6c605349
1 // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 // Distributed under an MIT license: https://codemirror.net/LICENSE
5 if (typeof exports
== "object" && typeof module
== "object") // CommonJS
6 mod(require("../../lib/codemirror"), require("./xml-hint"));
7 else if (typeof define
== "function" && define
.amd
) // AMD
8 define(["../../lib/codemirror", "./xml-hint"], mod
);
9 else // Plain browser env
11 })(function(CodeMirror
) {
14 var langs
= "ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" ");
15 var targets
= ["_blank", "_self", "_top", "_parent"];
16 var charsets
= ["ascii", "utf-8", "utf-16", "latin1", "latin1"];
17 var methods
= ["get", "post", "put", "delete"];
18 var encs
= ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"];
19 var media
= ["all", "screen", "print", "embossed", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "speech",
20 "3d-glasses", "resolution [>][<][=] [X]", "device-aspect-ratio: X/Y", "orientation:portrait",
21 "orientation:landscape", "device-height: [X]", "device-width: [X]"];
22 var s
= { attrs
: {} }; // Simple tag, reused for a whole lot of tags
27 href
: null, ping
: null, type
: null,
39 alt
: null, coords
: null, href
: null, target
: null, ping
: null,
40 media
: media
, hreflang
: langs
, type
: null,
41 shape
: ["default", "rect", "circle", "poly"]
48 src
: null, mediagroup
: null,
49 crossorigin
: ["anonymous", "use-credentials"],
50 preload
: ["none", "metadata", "auto"],
51 autoplay
: ["", "autoplay"],
53 controls
: ["", "controls"]
57 base
: { attrs
: { href
: null, target
: targets
} },
62 blockquote
: { attrs
: { cite
: null } },
67 form
: null, formaction
: null, name
: null, value
: null,
68 autofocus
: ["", "autofocus"],
69 disabled
: ["", "autofocus"],
72 formnovalidate
: ["", "novalidate"],
74 type
: ["submit", "reset", "button"]
77 canvas
: { attrs
: { width
: null, height
: null } },
82 col
: { attrs
: { span
: null } },
83 colgroup
: { attrs
: { span
: null } },
86 type
: ["command", "checkbox", "radio"],
87 label
: null, icon
: null, radiogroup
: null, command
: null, title
: null,
88 disabled
: ["", "disabled"],
89 checked
: ["", "checked"]
92 data
: { attrs
: { value
: null } },
93 datagrid
: { attrs
: { disabled
: ["", "disabled"], multiple
: ["", "multiple"] } },
94 datalist
: { attrs
: { data
: null } },
96 del
: { attrs
: { cite
: null, datetime
: null } },
97 details
: { attrs
: { open
: ["", "open"] } },
101 dialog
: { attrs
: { open
: null } },
105 embed
: { attrs
: { src
: null, type
: null, width
: null, height
: null } },
106 eventsource
: { attrs
: { src
: null } },
107 fieldset
: { attrs
: { disabled
: ["", "disabled"], form
: null, name
: null } },
114 action
: null, name
: null,
115 "accept-charset": charsets
,
116 autocomplete
: ["on", "off"],
119 novalidate
: ["", "novalidate"],
125 h1
: s
, h2
: s
, h3
: s
, h4
: s
, h5
: s
, h6
: s
,
128 children
: ["title", "base", "link", "style", "meta", "script", "noscript", "command"]
134 attrs
: { manifest
: null },
135 children
: ["head", "body"]
140 src
: null, srcdoc
: null, name
: null, width
: null, height
: null,
141 sandbox
: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"],
142 seamless
: ["", "seamless"]
147 alt
: null, src
: null, ismap
: null, usemap
: null, width
: null, height
: null,
148 crossorigin
: ["anonymous", "use-credentials"]
153 alt
: null, dirname
: null, form
: null, formaction
: null,
154 height
: null, list
: null, max
: null, maxlength
: null, min
: null,
155 name
: null, pattern
: null, placeholder
: null, size
: null, src
: null,
156 step
: null, value
: null, width
: null,
157 accept
: ["audio/*", "video/*", "image/*"],
158 autocomplete
: ["on", "off"],
159 autofocus
: ["", "autofocus"],
160 checked
: ["", "checked"],
161 disabled
: ["", "disabled"],
164 formnovalidate
: ["", "novalidate"],
166 multiple
: ["", "multiple"],
167 readonly
: ["", "readonly"],
168 required
: ["", "required"],
169 type
: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month",
170 "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio",
171 "file", "submit", "image", "reset", "button"]
174 ins
: { attrs
: { cite
: null, datetime
: null } },
178 challenge
: null, form
: null, name
: null,
179 autofocus
: ["", "autofocus"],
180 disabled
: ["", "disabled"],
184 label
: { attrs
: { "for": null, form
: null } },
186 li
: { attrs
: { value
: null } },
189 href
: null, type
: null,
192 sizes
: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"]
195 map
: { attrs
: { name
: null } },
197 menu
: { attrs
: { label
: null, type
: ["list", "context", "toolbar"] } },
202 name
: ["viewport", "application-name", "author", "description", "generator", "keywords"],
203 "http-equiv": ["content-language", "content-type", "default-style", "refresh"]
206 meter
: { attrs
: { value
: null, min
: null, low
: null, high
: null, max
: null, optimum
: null } },
212 data
: null, type
: null, name
: null, usemap
: null, form
: null, width
: null, height
: null,
213 typemustmatch
: ["", "typemustmatch"]
216 ol
: { attrs
: { reversed
: ["", "reversed"], start
: null, type
: ["1", "a", "A", "i", "I"] } },
217 optgroup
: { attrs
: { disabled
: ["", "disabled"], label
: null } },
218 option
: { attrs
: { disabled
: ["", "disabled"], label
: null, selected
: ["", "selected"], value
: null } },
219 output
: { attrs
: { "for": null, form
: null, name
: null } },
221 param
: { attrs
: { name
: null, value
: null } },
223 progress
: { attrs
: { value
: null, max
: null } },
224 q
: { attrs
: { cite
: null } },
232 type
: ["text/javascript"],
234 async
: ["", "async"],
235 defer
: ["", "defer"],
242 form
: null, name
: null, size
: null,
243 autofocus
: ["", "autofocus"],
244 disabled
: ["", "disabled"],
245 multiple
: ["", "multiple"]
249 source
: { attrs
: { src
: null, type
: null, media
: null } },
265 td
: { attrs
: { colspan
: null, rowspan
: null, headers
: null } },
268 dirname
: null, form
: null, maxlength
: null, name
: null, placeholder
: null,
269 rows
: null, cols
: null,
270 autofocus
: ["", "autofocus"],
271 disabled
: ["", "disabled"],
272 readonly
: ["", "readonly"],
273 required
: ["", "required"],
274 wrap
: ["soft", "hard"]
278 th
: { attrs
: { colspan
: null, rowspan
: null, headers
: null, scope
: ["row", "col", "rowgroup", "colgroup"] } },
280 time
: { attrs
: { datetime
: null } },
285 src
: null, label
: null, "default": null,
286 kind
: ["subtitles", "captions", "descriptions", "chapters", "metadata"],
296 src
: null, poster
: null, width
: null, height
: null,
297 crossorigin
: ["anonymous", "use-credentials"],
298 preload
: ["auto", "metadata", "none"],
299 autoplay
: ["", "autoplay"],
300 mediagroup
: ["movie"],
301 muted
: ["", "muted"],
302 controls
: ["", "controls"]
309 accesskey
: ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
311 contenteditable
: ["true", "false"],
313 dir
: ["ltr", "rtl", "auto"],
314 draggable
: ["true", "false", "auto"],
315 dropzone
: ["copy", "move", "link", "string:", "file:"],
322 itemscope
: ["itemscope"],
325 spellcheck
: ["true", "false"],
326 autocorrect
: ["true", "false"],
327 autocapitalize
: ["true", "false"],
329 tabindex
: ["1", "2", "3", "4", "5", "6", "7", "8", "9"],
331 translate
: ["yes", "no"],
333 rel
: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"]
335 function populate(obj
) {
336 for (var attr
in globalAttrs
) if (globalAttrs
.hasOwnProperty(attr
))
337 obj
.attrs
[attr
] = globalAttrs
[attr
];
341 for (var tag
in data
) if (data
.hasOwnProperty(tag
) && data
[tag
] != s
)
344 CodeMirror
.htmlSchema
= data
;
345 function htmlHint(cm
, options
) {
346 var local
= {schemaInfo
: data
};
347 if (options
) for (var opt
in options
) local
[opt
] = options
[opt
];
348 return CodeMirror
.hint
.xml(cm
, local
);
350 CodeMirror
.registerHelper("hint", "html", htmlHint
);