Ticket #4556: dtd.js

File dtd.js, 7.5 KB (added by Jonathan Neal, 14 years ago)

Modified dtd.js for preliminary HTML5 support

Line 
1/*
2Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
3For licensing, see LICENSE.html 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 editor in
14 * its internal operations.
15 *
16 * Each element in the DTD is represented by a
17 * property in this object. Each property contains the list of elements that
18 * can be contained by the element. Text is represented by the "#" property.
19 *
20 * Several special grouping properties are also available. Their names start
21 * with the "$" character.
22 * @namespace
23 * @example
24 * // Check if "div" can be contained in a "p" element.
25 * alert( !!CKEDITOR.dtd[ 'p' ][ 'div' ] );  "false"
26 * @example
27 * // Check if "p" can be contained in a "div" element.
28 * alert( !!CKEDITOR.dtd[ 'div' ][ 'p' ] );  "true"
29 * @example
30 * // Check if "p" is a block element.
31 * alert( !!CKEDITOR.dtd.$block[ 'p' ] );  "true"
32 */
33CKEDITOR.dtd = (function()
34{
35        var X = CKEDITOR.tools.extend,
36
37                A = {isindex:1,fieldset:1},
38                B = {input:1,button:1,select:1,textarea:1,label:1},
39                C = X({a:1},B),
40                D = X({iframe:1},C),
41                E = {hr:1,ul:1,menu:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,m:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1},
42                F = {ins:1,del:1,script:1},
43                G = X({b:1,acronym:1,bdo:1,'var':1,'#':1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1},F),
44                H = X({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1},G),
45                I = X({p:1},H),
46                J = X({iframe:1},H,B),
47                K = {img:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,'#':1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,'var':1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,m:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1},
48
49                L = X({a:1},J),
50                M = {tr:1},
51                N = {'#':1},
52                O = X({param:1},K),
53                P = X({form:1},A,D,E,I),
54                Q = {li:1},
55                R = {style:1,script:1},
56                S = {base:1,link:1,meta:1,title:1},
57                T = X(S,R),
58                U = {head:1,body:1},
59                V = {html:1};
60
61        var block = {address:1,blockquote:1,center:1,dir:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,m:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,menu:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1};
62
63        return /** @lends CKEDITOR.dtd */ {
64
65                // The "$" items have been added manually.
66
67                // List of elements living outside body.
68                $nonBodyContent: X(V,U,S),
69
70                /**
71                 * List of block elements, like "p" or "div".
72                 * @type Object
73                 * @example
74                 */
75                $block : block,
76
77                /**
78                 * List of block limit elements.
79                 * @type Object
80                 * @example
81                 */
82                $blockLimit : { body:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,m:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,td:1,th:1,caption:1,form:1 },
83
84                $inline : L,    // Just like span.
85
86                $body : X({script:1,style:1}, block),
87
88                $cdata : {script:1,style:1},
89
90                /**
91                 * List of empty (self-closing) elements, like "br" or "img".
92                 * @type Object
93                 * @example
94                 */
95                $empty : {area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1},
96
97                /**
98                 * List of list item elements, like "li" or "dd".
99                 * @type Object
100                 * @example
101                 */
102                $listItem : {dd:1,dt:1,li:1},
103
104                /**
105             * List of list root elements.
106             * @type Object
107             * @example
108             */
109            $list: { ul:1,ol:1,dl:1},
110
111                /**
112                 * Elements that accept text nodes, but are not possible to edit into
113                 * the browser.
114                 * @type Object
115                 * @example
116                 */
117                $nonEditable : {applet:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,script:1,textarea:1,param:1},
118
119                /**
120                 * List of elements that can be ignored if empty, like "b" or "span".
121                 * @type Object
122                 * @example
123                 */
124                $removeEmpty : {abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1},
125
126                /**
127                 * List of elements that have tabindex set to zero by default.
128                 * @type Object
129                 * @example
130                 */
131                $tabIndex : {a:1,area:1,button:1,input:1,object:1,select:1,textarea:1},
132
133                /**
134                 * List of elements used inside the "table" element, like "tbody" or "td".
135                 * @type Object
136                 * @example
137                 */
138                $tableContent : {caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1},
139
140        html: U,
141        head: T,
142        style: N,
143        script: N,
144        body: P,
145        base: {},
146        link: {},
147        meta: {},
148        title: N,
149        col : {},
150        tr : {td:1,th:1},
151        img : {},
152        colgroup : {col:1},
153        noscript : P,
154        td : P,
155        br : {},
156        th : P,
157        center : P,
158        kbd : L,
159        button : X(I,E),
160        basefont : {},
161        h5 : L,
162        h4 : L,
163        samp : L,
164        h6 : L,
165        ol : Q,
166        h1 : L,
167        h3 : L,
168        option : N,
169        h2 : L,
170        form : X(A,D,E,I),
171        select : {optgroup:1,option:1},
172        font : L,
173        ins : L,
174        menu : Q,
175        abbr : L,
176        label : L,
177        table : {thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1},
178        code : L,
179        script : N,
180        tfoot : M,
181        cite : L,
182        li : P,
183        input : {},
184        iframe : P,
185        strong : L,
186        textarea : N,
187        noframes : P,
188        big : L,
189        small : L,
190        span : L,
191        hr : {},
192        dt : L,
193        sub : L,
194        optgroup : {option:1},
195        param : {},
196        bdo : L,
197        'var' : L,
198        div : P,
199                section: P,
200                header: P,
201                footer: P,
202                nav: P,
203                article: P,
204                aside: P,
205                figure: P,
206                dialog: P,
207                hgroup: P,
208                m: L,
209                time: L,
210                meter: L,
211                menu: L,
212                command: L,
213                keygen: L,
214                output: L,
215                progress: O,
216                audio: O,
217                video: O,
218                details: O,
219                datagrid: O,
220                datalist: O,
221        object : O,
222        sup : L,
223        dd : P,
224        strike : L,
225        area : {},
226        dir : Q,
227        map : X({area:1,form:1,p:1},A,F,E),
228        applet : O,
229        dl : {dt:1,dd:1},
230        del : L,
231        isindex : {},
232        fieldset : X({legend:1},K),
233        thead : M,
234        ul : Q,
235        acronym : L,
236        b : L,
237        a : J,
238        blockquote : P,
239        caption : L,
240        i : L,
241        u : L,
242        tbody : M,
243        s : L,
244        address : X(D,I),
245        tt : L,
246        legend : L,
247        q : L,
248        pre : X(G,C),
249        p : L,
250        em : L,
251        dfn : L
252    };
253})();
254
255// PACKAGER_RENAME( CKEDITOR.dtd )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy