move a few things away in to-be-integrated/
[myslice.git] / to-be-integrated / third-party / codemirror-3.15 / addon / hint / html-hint.js
1 (function () {
2   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(" ");
3   var targets = ["_blank", "_self", "_top", "_parent"];
4   var charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"];
5   var methods = ["get", "post", "put", "delete"];
6   var encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"];
7   var media = ["all", "screen", "print", "embossed", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "speech",
8                "3d-glasses", "resolution [>][<][=] [X]", "device-aspect-ratio: X/Y", "orientation:portrait",
9                "orientation:landscape", "device-height: [X]", "device-width: [X]"];
10   var s = { attrs: {} }; // Simple tag, reused for a whole lot of tags
11
12   var data = {
13     a: {
14       attrs: {
15         href: null, ping: null, type: null,
16         media: media,
17         target: targets,
18         hreflang: langs
19       }
20     },
21     abbr: s,
22     acronym: s,
23     address: s,
24     applet: s,
25     area: {
26       attrs: {
27         alt: null, coords: null, href: null, target: null, ping: null,
28         media: media, hreflang: langs, type: null,
29         shape: ["default", "rect", "circle", "poly"]
30       }
31     },
32     article: s,
33     aside: s,
34     audio: {
35       attrs: {
36         src: null, mediagroup: null,
37         crossorigin: ["anonymous", "use-credentials"],
38         preload: ["none", "metadata", "auto"],
39         autoplay: ["", "autoplay"],
40         loop: ["", "loop"],
41         controls: ["", "controls"]
42       }
43     },
44     b: s,
45     base: { attrs: { href: null, target: targets } },
46     basefont: s,
47     bdi: s,
48     bdo: s,
49     big: s,
50     blockquote: { attrs: { cite: null } },
51     body: s,
52     br: s,
53     button: {
54       attrs: {
55         form: null, formaction: null, name: null, value: null,
56         autofocus: ["", "autofocus"],
57         disabled: ["", "autofocus"],
58         formenctype: encs,
59         formmethod: methods,
60         formnovalidate: ["", "novalidate"],
61         formtarget: targets,
62         type: ["submit", "reset", "button"]
63       }
64     },
65     canvas: { attrs: { width: null, height: null } },
66     caption: s,
67     center: s,
68     cite: s,
69     code: s,
70     col: { attrs: { span: null } },
71     colgroup: { attrs: { span: null } },
72     command: {
73       attrs: {
74         type: ["command", "checkbox", "radio"],
75         label: null, icon: null, radiogroup: null, command: null, title: null,
76         disabled: ["", "disabled"],
77         checked: ["", "checked"]
78       }
79     },
80     data: { attrs: { value: null } },
81     datagrid: { attrs: { disabled: ["", "disabled"], multiple: ["", "multiple"] } },
82     datalist: { attrs: { data: null } },
83     dd: s,
84     del: { attrs: { cite: null, datetime: null } },
85     details: { attrs: { open: ["", "open"] } },
86     dfn: s,
87     dir: s,
88     div: s,
89     dl: s,
90     dt: s,
91     em: s,
92     embed: { attrs: { src: null, type: null, width: null, height: null } },
93     eventsource: { attrs: { src: null } },
94     fieldset: { attrs: { disabled: ["", "disabled"], form: null, name: null } },
95     figcaption: s,
96     figure: s,
97     font: s,
98     footer: s,
99     form: {
100       attrs: {
101         action: null, name: null,
102         "accept-charset": charsets,
103         autocomplete: ["on", "off"],
104         enctype: encs,
105         method: methods,
106         novalidate: ["", "novalidate"],
107         target: targets
108       }
109     },
110     frame: s,
111     frameset: s,
112     h1: s, h2: s, h3: s, h4: s, h5: s, h6: s,
113     head: {
114       attrs: {},
115       children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"]
116     },
117     header: s,
118     hgroup: s,
119     hr: s,
120     html: {
121       attrs: { manifest: null },
122       children: ["head", "body"]
123     },
124     i: s,
125     iframe: {
126       attrs: {
127         src: null, srcdoc: null, name: null, width: null, height: null,
128         sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"],
129         seamless: ["", "seamless"]
130       }
131     },
132     img: {
133       attrs: {
134         alt: null, src: null, ismap: null, usemap: null, width: null, height: null,
135         crossorigin: ["anonymous", "use-credentials"]
136       }
137     },
138     input: {
139       attrs: {
140         alt: null, dirname: null, form: null, formaction: null,
141         height: null, list: null, max: null, maxlength: null, min: null,
142         name: null, pattern: null, placeholder: null, size: null, src: null,
143         step: null, value: null, width: null,
144         accept: ["audio/*", "video/*", "image/*"],
145         autocomplete: ["on", "off"],
146         autofocus: ["", "autofocus"],
147         checked: ["", "checked"],
148         disabled: ["", "disabled"],
149         formenctype: encs,
150         formmethod: methods,
151         formnovalidate: ["", "novalidate"],
152         formtarget: targets,
153         multiple: ["", "multiple"],
154         readonly: ["", "readonly"],
155         required: ["", "required"],
156         type: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month",
157                "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio",
158                "file", "submit", "image", "reset", "button"]
159       }
160     },
161     ins: { attrs: { cite: null, datetime: null } },
162     kbd: s,
163     keygen: {
164       attrs: {
165         challenge: null, form: null, name: null,
166         autofocus: ["", "autofocus"],
167         disabled: ["", "disabled"],
168         keytype: ["RSA"]
169       }
170     },
171     label: { attrs: { "for": null, form: null } },
172     legend: s,
173     li: { attrs: { value: null } },
174     link: {
175       attrs: {
176         href: null, type: null,
177         hreflang: langs,
178         media: media,
179         sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"]
180       }
181     },
182     map: { attrs: { name: null } },
183     mark: s,
184     menu: { attrs: { label: null, type: ["list", "context", "toolbar"] } },
185     meta: {
186       attrs: {
187         content: null,
188         charset: charsets,
189         name: ["viewport", "application-name", "author", "description", "generator", "keywords"],
190         "http-equiv": ["content-language", "content-type", "default-style", "refresh"]
191       }
192     },
193     meter: { attrs: { value: null, min: null, low: null, high: null, max: null, optimum: null } },
194     nav: s,
195     noframes: s,
196     noscript: s,
197     object: {
198       attrs: {
199         data: null, type: null, name: null, usemap: null, form: null, width: null, height: null,
200         typemustmatch: ["", "typemustmatch"]
201       }
202     },
203     ol: { attrs: { reversed: ["", "reversed"], start: null, type: ["1", "a", "A", "i", "I"] } },
204     optgroup: { attrs: { disabled: ["", "disabled"], label: null } },
205     option: { attrs: { disabled: ["", "disabled"], label: null, selected: ["", "selected"], value: null } },
206     output: { attrs: { "for": null, form: null, name: null } },
207     p: s,
208     param: { attrs: { name: null, value: null } },
209     pre: s,
210     progress: { attrs: { value: null, max: null } },
211     q: { attrs: { cite: null } },
212     rp: s,
213     rt: s,
214     ruby: s,
215     s: s,
216     samp: s,
217     script: {
218       attrs: {
219         type: ["text/javascript"],
220         src: null,
221         async: ["", "async"],
222         defer: ["", "defer"],
223         charset: charsets
224       }
225     },
226     section: s,
227     select: {
228       attrs: {
229         form: null, name: null, size: null,
230         autofocus: ["", "autofocus"],
231         disabled: ["", "disabled"],
232         multiple: ["", "multiple"]
233       }
234     },
235     small: s,
236     source: { attrs: { src: null, type: null, media: null } },
237     span: s,
238     strike: s,
239     strong: s,
240     style: {
241       attrs: {
242         type: ["text/css"],
243         media: media,
244         scoped: null
245       }
246     },
247     sub: s,
248     summary: s,
249     sup: s,
250     table: s,
251     tbody: s,
252     td: { attrs: { colspan: null, rowspan: null, headers: null } },
253     textarea: {
254       attrs: {
255         dirname: null, form: null, maxlength: null, name: null, placeholder: null,
256         rows: null, cols: null,
257         autofocus: ["", "autofocus"],
258         disabled: ["", "disabled"],
259         readonly: ["", "readonly"],
260         required: ["", "required"],
261         wrap: ["soft", "hard"]
262       }
263     },
264     tfoot: s,
265     th: { attrs: { colspan: null, rowspan: null, headers: null, scope: ["row", "col", "rowgroup", "colgroup"] } },
266     thead: s,
267     time: { attrs: { datetime: null } },
268     title: s,
269     tr: s,
270     track: {
271       attrs: {
272         src: null, label: null, "default": null,
273         kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"],
274         srclang: langs
275       }
276     },
277     tt: s,
278     u: s,
279     ul: s,
280     "var": s,
281     video: {
282       attrs: {
283         src: null, poster: null, width: null, height: null,
284         crossorigin: ["anonymous", "use-credentials"],
285         preload: ["auto", "metadata", "none"],
286         autoplay: ["", "autoplay"],
287         mediagroup: ["movie"],
288         muted: ["", "muted"],
289         controls: ["", "controls"]
290       }
291     },
292     wbr: s
293   };
294
295   var globalAttrs = {
296     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"],
297     "class": null,
298     contenteditable: ["true", "false"],
299     contextmenu: null,
300     dir: ["ltr", "rtl", "auto"],
301     draggable: ["true", "false", "auto"],
302     dropzone: ["copy", "move", "link", "string:", "file:"],
303     hidden: ["hidden"],
304     id: null,
305     inert: ["inert"],
306     itemid: null,
307     itemprop: null,
308     itemref: null,
309     itemscope: ["itemscope"],
310     itemtype: null,
311     lang: ["en", "es"],
312     spellcheck: ["true", "false"],
313     style: null,
314     tabindex: ["1", "2", "3", "4", "5", "6", "7", "8", "9"],
315     title: null,
316     translate: ["yes", "no"],
317     onclick: null,
318     rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"]
319   };
320   function populate(obj) {
321     for (var attr in globalAttrs) if (globalAttrs.hasOwnProperty(attr))
322       obj.attrs[attr] = globalAttrs[attr];
323   }
324
325   populate(s);
326   for (var tag in data) if (data.hasOwnProperty(tag) && data[tag] != s)
327     populate(data[tag]);
328
329   CodeMirror.htmlSchema = data;
330   function htmlHint(cm, options) {
331     var local = {schemaInfo: data};
332     if (options) for (var opt in options) local[opt] = options[opt];
333     return CodeMirror.hint.xml(cm, local);
334   }
335   CodeMirror.htmlHint = htmlHint; // deprecated
336   CodeMirror.registerHelper("hint", "html", htmlHint);
337 })();