]> git.immae.eu Git - perso/Immae/Projets/packagist/connexionswing-ckeditor-component.git/blame - sources/core/dtd.js
Upgrade to 4.5.7 and add some plugin
[perso/Immae/Projets/packagist/connexionswing-ckeditor-component.git] / sources / core / dtd.js
CommitLineData
3b35bd27
IB
1/**
2 * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
7adcb81e
IB
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
4 */
5
6/**
7 * @fileOverview Defines the {@link CKEDITOR.dtd} object, which holds the DTD
8 * mapping for XHTML 1.0 Transitional. This file was automatically
9 * generated from the file: xhtml1-transitional.dtd.
10 */
11
12/**
13 * Holds and object representation of the HTML DTD to be used by the
14 * editor in its internal operations.
15 *
16 * Each element in the DTD is represented by a property in this object. Each
17 * property contains the list of elements that can be contained by the element.
18 * Text is represented by the `#` property.
19 *
20 * Several special grouping properties are also available. Their names start
21 * with the `$` character.
22 *
23 * // Check if <div> can be contained in a <p> element.
24 * alert( !!CKEDITOR.dtd[ 'p' ][ 'div' ] ); // false
25 *
26 * // Check if <p> can be contained in a <div> element.
27 * alert( !!CKEDITOR.dtd[ 'div' ][ 'p' ] ); // true
28 *
29 * // Check if <p> is a block element.
30 * alert( !!CKEDITOR.dtd.$block[ 'p' ] ); // true
31 *
32 * @class CKEDITOR.dtd
33 * @singleton
34 */
35CKEDITOR.dtd = ( function() {
36 'use strict';
37
38 var X = CKEDITOR.tools.extend,
39 // Subtraction rest of sets, from the first set.
40 Y = function( source, removed ) {
41 var substracted = CKEDITOR.tools.clone( source );
42 for ( var i = 1; i < arguments.length; i++ ) {
43 removed = arguments[ i ];
44 for ( var name in removed )
45 delete substracted[ name ];
46 }
47 return substracted;
48 };
49
50 // Phrasing elements.
51 // P = { a: 1, em: 1, strong: 1, small: 1, abbr: 1, dfn: 1, i: 1, b: 1, s: 1,
52 // u: 1, code: 1, 'var': 1, samp: 1, kbd: 1, sup: 1, sub: 1, q: 1, cite: 1,
53 // span: 1, bdo: 1, bdi: 1, br: 1, wbr: 1, ins: 1, del: 1, img: 1, embed: 1,
54 // object: 1, iframe: 1, map: 1, area: 1, script: 1, noscript: 1, ruby: 1,
55 // video: 1, audio: 1, input: 1, textarea: 1, select: 1, button: 1, label: 1,
56 // output: 1, keygen: 1, progress: 1, command: 1, canvas: 1, time: 1,
57 // meter: 1, detalist: 1 },
58
59 // Flow elements.
60 // F = { a: 1, p: 1, hr: 1, pre: 1, ul: 1, ol: 1, dl: 1, div: 1, h1: 1, h2: 1,
61 // h3: 1, h4: 1, h5: 1, h6: 1, hgroup: 1, address: 1, blockquote: 1, ins: 1,
62 // del: 1, object: 1, map: 1, noscript: 1, section: 1, nav: 1, article: 1,
63 // aside: 1, header: 1, footer: 1, video: 1, audio: 1, figure: 1, table: 1,
64 // form: 1, fieldset: 1, menu: 1, canvas: 1, details:1 },
65
66 // Text can be everywhere.
67 // X( P, T );
68 // Flow elements set consists of phrasing elements set.
69 // X( F, P );
70
71 var P = {}, F = {},
72 // Intersection of flow elements set and phrasing elements set.
73 PF = {
74 a: 1, abbr: 1, area: 1, audio: 1, b: 1, bdi: 1, bdo: 1, br: 1, button: 1, canvas: 1, cite: 1,
75 code: 1, command: 1, datalist: 1, del: 1, dfn: 1, em: 1, embed: 1, i: 1, iframe: 1, img: 1,
76 input: 1, ins: 1, kbd: 1, keygen: 1, label: 1, map: 1, mark: 1, meter: 1, noscript: 1, object: 1,
77 output: 1, progress: 1, q: 1, ruby: 1, s: 1, samp: 1, script: 1, select: 1, small: 1, span: 1,
78 strong: 1, sub: 1, sup: 1, textarea: 1, time: 1, u: 1, 'var': 1, video: 1, wbr: 1
79 },
80 // F - PF (Flow Only).
81 FO = {
82 address: 1, article: 1, aside: 1, blockquote: 1, details: 1, div: 1, dl: 1, fieldset: 1,
83 figure: 1, footer: 1, form: 1, h1: 1, h2: 1, h3: 1, h4: 1, h5: 1, h6: 1, header: 1, hgroup: 1,
84 hr: 1, main: 1, menu: 1, nav: 1, ol: 1, p: 1, pre: 1, section: 1, table: 1, ul: 1
85 },
86 // Metadata elements.
87 M = { command: 1, link: 1, meta: 1, noscript: 1, script: 1, style: 1 },
88 // Empty.
89 E = {},
90 // Text.
91 T = { '#': 1 },
92
93 // Deprecated phrasing elements.
94 DP = { acronym: 1, applet: 1, basefont: 1, big: 1, font: 1, isindex: 1, strike: 1, style: 1, tt: 1 }, // TODO remove "style".
95 // Deprecated flow only elements.
96 DFO = { center: 1, dir: 1, noframes: 1 };
97
98 // Phrasing elements := PF + T + DP
99 X( P, PF, T, DP );
100 // Flow elements := FO + P + DFO
101 X( F, FO, P, DFO );
102
103 var dtd = {
104 a: Y( P, { a: 1, button: 1 } ), // Treat as normal inline element (not a transparent one).
105 abbr: P,
106 address: F,
107 area: E,
108 article: F,
109 aside: F,
110 audio: X( { source: 1, track: 1 }, F ),
111 b: P,
112 base: E,
113 bdi: P,
114 bdo: P,
115 blockquote: F,
116 body: F,
117 br: E,
118 button: Y( P, { a: 1, button: 1 } ),
119 canvas: P, // Treat as normal inline element (not a transparent one).
120 caption: F,
121 cite: P,
122 code: P,
123 col: E,
124 colgroup: { col: 1 },
125 command: E,
126 datalist: X( { option: 1 }, P ),
127 dd: F,
128 del: P, // Treat as normal inline element (not a transparent one).
129 details: X( { summary: 1 }, F ),
130 dfn: P,
131 div: F,
132 dl: { dt: 1, dd: 1 },
133 dt: F,
134 em: P,
135 embed: E,
136 fieldset: X( { legend: 1 }, F ),
137 figcaption: F,
138 figure: X( { figcaption: 1 }, F ),
139 footer: F,
140 form: F,
141 h1: P,
142 h2: P,
143 h3: P,
144 h4: P,
145 h5: P,
146 h6: P,
147 head: X( { title: 1, base: 1 }, M ),
148 header: F,
149 hgroup: { h1: 1, h2: 1, h3: 1, h4: 1, h5: 1, h6: 1 },
150 hr: E,
151 html: X( { head: 1, body: 1 }, F, M ), // Head and body are optional...
152 i: P,
153 iframe: T,
154 img: E,
155 input: E,
156 ins: P, // Treat as normal inline element (not a transparent one).
157 kbd: P,
158 keygen: E,
159 label: P,
160 legend: P,
161 li: F,
162 link: E,
163 // Can't be a descendant of article, aside, footer, header, nav, but we don't need this
164 // complication. As well as checking if it's used only once.
165 main: F,
166 map: F,
167 mark: P, // Treat as normal inline element (not a transparent one).
168 menu: X( { li: 1 }, F ),
169 meta: E,
170 meter: Y( P, { meter: 1 } ),
171 nav: F,
172 noscript: X( { link: 1, meta: 1, style: 1 }, P ), // Treat as normal inline element (not a transparent one).
173 object: X( { param: 1 }, P ), // Treat as normal inline element (not a transparent one).
174 ol: { li: 1 },
175 optgroup: { option: 1 },
176 option: T,
177 output: P,
178 p: P,
179 param: E,
180 pre: P,
181 progress: Y( P, { progress: 1 } ),
182 q: P,
183 rp: P,
184 rt: P,
185 ruby: X( { rp: 1, rt: 1 }, P ),
186 s: P,
187 samp: P,
188 script: T,
189 section: F,
190 select: { optgroup: 1, option: 1 },
191 small: P,
192 source: E,
193 span: P,
194 strong: P,
195 style: T,
196 sub: P,
197 summary: X( { h1: 1, h2: 1, h3: 1, h4: 1, h5: 1, h6: 1 }, P ),
198 sup: P,
199 table: { caption: 1, colgroup: 1, thead: 1, tfoot: 1, tbody: 1, tr: 1 },
200 tbody: { tr: 1 },
201 td: F,
202 textarea: T,
203 tfoot: { tr: 1 },
204 th: F,
205 thead: { tr: 1 },
206 time: Y( P, { time: 1 } ),
207 title: T,
208 tr: { th: 1, td: 1 },
209 track: E,
210 u: P,
211 ul: { li: 1 },
212 'var': P,
213 video: X( { source: 1, track: 1 }, F ),
214 wbr: E,
215
216 // Deprecated tags.
217 acronym: P,
218 applet: X( { param: 1 }, F ),
219 basefont: E,
220 big: P,
221 center: F,
222 dialog: E,
223 dir: { li: 1 },
224 font: P,
225 isindex: E,
226 noframes: F,
227 strike: P,
228 tt: P
229 };
230
231 X( dtd, {
232 /**
233 * List of block elements, like `<p>` or `<div>`.
234 */
235 $block: X( { audio: 1, dd: 1, dt: 1, figcaption: 1, li: 1, video: 1 }, FO, DFO ),
236
237 /**
238 * List of elements that contain other blocks, in which block-level operations should be limited,
239 * this property is not intended to be checked directly, use {@link CKEDITOR.dom.elementPath#blockLimit} instead.
240 *
241 * Some examples of editor behaviors that are impacted by block limits:
242 *
243 * * Enter key never split a block-limit element;
244 * * Style application is constraint by the block limit of the current selection.
245 * * Pasted html will be inserted into the block limit of the current selection.
246 *
247 * **Note:** As an exception `<li>` is not considered as a block limit, as it's generally used as a text block.
248 */
249 $blockLimit: {
250 article: 1, aside: 1, audio: 1, body: 1, caption: 1, details: 1, dir: 1, div: 1, dl: 1,
251 fieldset: 1, figcaption: 1, figure: 1, footer: 1, form: 1, header: 1, hgroup: 1, main: 1, menu: 1, nav: 1,
252 ol: 1, section: 1, table: 1, td: 1, th: 1, tr: 1, ul: 1, video: 1
253 },
254
255 /**
256 * List of elements that contain character data.
257 */
258 $cdata: { script: 1, style: 1 },
259
260 /**
261 * List of elements that are accepted as inline editing hosts.
262 */
263 $editable: {
264 address: 1, article: 1, aside: 1, blockquote: 1, body: 1, details: 1, div: 1, fieldset: 1,
265 figcaption: 1, footer: 1, form: 1, h1: 1, h2: 1, h3: 1, h4: 1, h5: 1, h6: 1, header: 1, hgroup: 1,
266 main: 1, nav: 1, p: 1, pre: 1, section: 1
267 },
268
269 /**
270 * List of empty (self-closing) elements, like `<br>` or `<img>`.
271 */
272 $empty: {
273 area: 1, base: 1, basefont: 1, br: 1, col: 1, command: 1, dialog: 1, embed: 1, hr: 1, img: 1,
274 input: 1, isindex: 1, keygen: 1, link: 1, meta: 1, param: 1, source: 1, track: 1, wbr: 1
275 },
276
277 /**
278 * List of inline (`<span>` like) elements.
279 */
280 $inline: P,
281
282 /**
283 * List of list root elements.
284 */
285 $list: { dl: 1, ol: 1, ul: 1 },
286
287 /**
288 * List of list item elements, like `<li>` or `<dd>`.
289 */
290 $listItem: { dd: 1, dt: 1, li: 1 },
291
292 /**
293 * List of elements which may live outside body.
294 */
295 $nonBodyContent: X( { body: 1, head: 1, html: 1 }, dtd.head ),
296
297 /**
298 * Elements that accept text nodes, but are not possible to edit into the browser.
299 */
300 $nonEditable: {
301 applet: 1, audio: 1, button: 1, embed: 1, iframe: 1, map: 1, object: 1, option: 1,
302 param: 1, script: 1, textarea: 1, video: 1
303 },
304
305 /**
306 * Elements that are considered objects, therefore selected as a whole in the editor.
307 */
308 $object: {
309 applet: 1, audio: 1, button: 1, hr: 1, iframe: 1, img: 1, input: 1, object: 1, select: 1,
310 table: 1, textarea: 1, video: 1
311 },
312
313 /**
314 * List of elements that can be ignored if empty, like `<b>` or `<span>`.
315 */
316 $removeEmpty: {
317 abbr: 1, acronym: 1, b: 1, bdi: 1, bdo: 1, big: 1, cite: 1, code: 1, del: 1, dfn: 1,
318 em: 1, font: 1, i: 1, ins: 1, label: 1, kbd: 1, mark: 1, meter: 1, output: 1, q: 1, ruby: 1, s: 1,
319 samp: 1, small: 1, span: 1, strike: 1, strong: 1, sub: 1, sup: 1, time: 1, tt: 1, u: 1, 'var': 1
320 },
321
322 /**
323 * List of elements that have tabindex set to zero by default.
324 */
325 $tabIndex: { a: 1, area: 1, button: 1, input: 1, object: 1, select: 1, textarea: 1 },
326
327 /**
328 * List of elements used inside the `<table>` element, like `<tbody>` or `<td>`.
329 */
330 $tableContent: { caption: 1, col: 1, colgroup: 1, tbody: 1, td: 1, tfoot: 1, th: 1, thead: 1, tr: 1 },
331
332 /**
333 * List of "transparent" elements. See [W3C's definition of "transparent" element](http://dev.w3.org/html5/markup/terminology.html#transparent).
334 */
335 $transparent: { a: 1, audio: 1, canvas: 1, del: 1, ins: 1, map: 1, noscript: 1, object: 1, video: 1 },
336
337 /**
338 * List of elements that are not to exist standalone that must live under it's parent element.
339 */
340 $intermediate: {
341 caption: 1, colgroup: 1, dd: 1, dt: 1, figcaption: 1, legend: 1, li: 1, optgroup: 1,
342 option: 1, rp: 1, rt: 1, summary: 1, tbody: 1, td: 1, tfoot: 1, th: 1, thead: 1, tr: 1
343 }
344 } );
345
346 return dtd;
347} )();
348
349// PACKAGER_RENAME( CKEDITOR.dtd )