author | Anthony Ly <anthonyly.com@gmail.com> |
Tue, 12 Mar 2013 18:21:39 +0100 | |
changeset 206 | 919b4ddb13fa |
parent 204 | 09a1c134465b |
permissions | -rw-r--r-- |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2 |
* TinyMCE Schema.js |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
3 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
4 |
* Duck-punched by WordPress core to support a sane schema superset. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
5 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
6 |
* Copyright, Moxiecode Systems AB |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
7 |
* Released under LGPL License. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
8 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
9 |
* License: http://www.tinymce.com/license |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
10 |
* Contributing: http://www.tinymce.com/contributing |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
11 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
12 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
13 |
(function(tinymce) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
14 |
var mapCache = {}, makeMap = tinymce.makeMap, each = tinymce.each; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
15 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
16 |
function split(str, delim) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
17 |
return str.split(delim || ','); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
18 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
19 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
20 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
21 |
* Unpacks the specified lookup and string data it will also parse it into an object |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
22 |
* map with sub object for it's children. This will later also include the attributes. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
23 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
24 |
function unpack(lookup, data) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
25 |
var key, elements = {}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
26 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
27 |
function replace(value) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
28 |
return value.replace(/[A-Z]+/g, function(key) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
29 |
return replace(lookup[key]); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
30 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
31 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
32 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
33 |
// Unpack lookup |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
34 |
for (key in lookup) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
35 |
if (lookup.hasOwnProperty(key)) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
36 |
lookup[key] = replace(lookup[key]); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
37 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
38 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
39 |
// Unpack and parse data into object map |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
40 |
replace(data).replace(/#/g, '#text').replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g, function(str, name, attributes, children) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
41 |
attributes = split(attributes, '|'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
42 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
43 |
elements[name] = { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
44 |
attributes : makeMap(attributes), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
45 |
attributesOrder : attributes, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
46 |
children : makeMap(children, '|', {'#comment' : {}}) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
47 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
48 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
49 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
50 |
return elements; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
51 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
52 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
53 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
54 |
* Returns the HTML5 schema and caches it in the mapCache. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
55 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
56 |
function getHTML5() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
57 |
var html5 = mapCache.html5; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
58 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
59 |
if (!html5) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
60 |
html5 = mapCache.html5 = unpack({ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
61 |
A : 'accesskey|class|contextmenu|dir|draggable|dropzone|hidden|id|inert|itemid|itemprop|itemref|itemscope|itemtype|lang|spellcheck|style|tabindex|title|translate|item|role|subject|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
62 |
B : '#|a|abbr|area|audio|b|bdi|bdo|br|button|canvas|cite|code|command|data|datalist|del|dfn|em|embed|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|math|meta|meter|noscript|object|output|progress|q|ruby|s|samp|script|select|small|span|strong|sub|sup|svg|textarea|time|u|var|video|wbr', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
63 |
C : '#|a|abbr|area|address|article|aside|audio|b|bdi|bdo|blockquote|br|button|canvas|cite|code|command|data|datalist|del|details|dfn|dialog|div|dl|em|embed|fieldset|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|math|menu|meta|meter|nav|noscript|ol|object|output|p|pre|progress|q|ruby|s|samp|script|section|select|small|span|strong|style|sub|sup|svg|table|textarea|time|u|ul|var|video|wbr' |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
64 |
}, 'html[A|manifest][body|head]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
65 |
'head[A][base|command|link|meta|noscript|script|style|title]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
66 |
'title[A][#]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
67 |
'base[A|href|target][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
68 |
'link[A|href|rel|media|type|sizes|crossorigin|hreflang][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
69 |
'meta[A|http-equiv|name|content|charset][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
70 |
'style[A|type|media|scoped][#]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
71 |
'script[A|charset|type|src|defer|async|crossorigin][#]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
72 |
'noscript[A][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
73 |
'body[A|onafterprint|onbeforeprint|onbeforeunload|onblur|onerror|onfocus|onfullscreenchange|onfullscreenerror|onhashchange|onload|onmessage|onoffline|ononline|onpagehide|onpageshow|onpopstate|onresize|onscroll|onstorage|onunload][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
74 |
'section[A][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
75 |
'nav[A][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
76 |
'article[A][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
77 |
'aside[A][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
78 |
'h1[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
79 |
'h2[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
80 |
'h3[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
81 |
'h4[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
82 |
'h5[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
83 |
'h6[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
84 |
'hgroup[A][h1|h2|h3|h4|h5|h6]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
85 |
'header[A][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
86 |
'footer[A][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
87 |
'address[A][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
88 |
'p[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
89 |
'br[A][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
90 |
'pre[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
91 |
'dialog[A|open][C|dd|dt]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
92 |
'blockquote[A|cite][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
93 |
'ol[A|start|reversed][li]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
94 |
'ul[A][li]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
95 |
'li[A|value][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
96 |
'dl[A][dd|dt]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
97 |
'dt[A][C|B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
98 |
'dd[A][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
99 |
'a[A|href|target|download|ping|rel|media|type][C|B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
100 |
'em[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
101 |
'strong[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
102 |
'small[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
103 |
's[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
104 |
'cite[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
105 |
'q[A|cite][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
106 |
'dfn[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
107 |
'abbr[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
108 |
'code[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
109 |
'var[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
110 |
'samp[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
111 |
'kbd[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
112 |
'sub[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
113 |
'sup[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
114 |
'i[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
115 |
'b[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
116 |
'u[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
117 |
'mark[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
118 |
'progress[A|value|max][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
119 |
'meter[A|value|min|max|low|high|optimum][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
120 |
'time[A|datetime][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
121 |
'ruby[A][B|rt|rp]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
122 |
'rt[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
123 |
'rp[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
124 |
'bdi[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
125 |
'bdo[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
126 |
'span[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
127 |
'ins[A|cite|datetime][C|B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
128 |
'del[A|cite|datetime][C|B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
129 |
'figure[A][C|legend|figcaption]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
130 |
'figcaption[A][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
131 |
'img[A|alt|src|srcset|crossorigin|usemap|ismap|width|height][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
132 |
'iframe[A|name|src|srcdoc|height|width|sandbox|seamless|allowfullscreen][C|B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
133 |
'embed[A|src|height|width|type][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
134 |
'object[A|data|type|typemustmatch|name|usemap|form|width|height][C|B|param]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
135 |
'param[A|name|value][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
136 |
'summary[A][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
137 |
'details[A|open][C|legend|summary]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
138 |
'command[A|type|label|icon|disabled|checked|radiogroup|command][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
139 |
'menu[A|type|label][C|li]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
140 |
'legend[A][C|B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
141 |
'div[A][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
142 |
'source[A|src|type|media][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
143 |
'track[A|kind|src|srclang|label|default][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
144 |
'audio[A|src|autobuffer|autoplay|loop|controls|crossorigin|preload|mediagroup|muted][C|source|track]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
145 |
'video[A|src|autobuffer|autoplay|loop|controls|width|height|poster|crossorigin|preload|mediagroup|muted][C|source|track]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
146 |
'hr[A][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
147 |
'form[A|accept-charset|action|autocomplete|enctype|method|name|novalidate|target][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
148 |
'fieldset[A|disabled|form|name][C|legend]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
149 |
'label[A|form|for][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
150 |
'input[A|type|accept|alt|autocomplete|autofocus|checked|dirname|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|height|inputmode|list|max|maxlength|min|multiple|name|pattern|placeholder|readonly|required|size|src|step|value|width|files][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
151 |
'button[A|autofocus|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|name|type|value][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
152 |
'select[A|autofocus|disabled|form|multiple|name|required|size][option|optgroup]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
153 |
'data[A|value][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
154 |
'datalist[A][B|option]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
155 |
'optgroup[A|disabled|label][option]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
156 |
'option[A|disabled|selected|label|value][#]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
157 |
'textarea[A|autocomplete|autofocus|cols|dirname|disabled|form|inputmode|maxlength|name|placeholder|readonly|required|rows|wrap][#]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
158 |
'keygen[A|autofocus|challenge|disabled|form|keytype|name][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
159 |
'output[A|for|form|name][B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
160 |
'canvas[A|width|height][a|button|input]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
161 |
'map[A|name][C|B]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
162 |
'area[A|alt|coords|shape|href|target|download|ping|rel|media|hreflang|type][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
163 |
'math[A][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
164 |
'svg[A][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
165 |
'table[A][caption|colgroup|thead|tfoot|tbody|tr]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
166 |
'caption[A][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
167 |
'colgroup[A|span][col]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
168 |
'col[A|span][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
169 |
'thead[A][tr]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
170 |
'tfoot[A][tr]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
171 |
'tbody[A][tr]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
172 |
'tr[A][th|td]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
173 |
'th[A|headers|rowspan|colspan|scope][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
174 |
'td[A|headers|rowspan|colspan][C]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
175 |
'wbr[A][]' |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
176 |
); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
177 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
178 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
179 |
return html5; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
180 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
181 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
182 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
183 |
* Returns the HTML4 schema and caches it in the mapCache. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
184 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
185 |
function getHTML4() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
186 |
var html4 = mapCache.html4; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
187 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
188 |
if (!html4) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
189 |
// This is the XHTML 1.0 transitional elements with it's attributes and children packed to reduce it's size |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
190 |
html4 = mapCache.html4 = unpack({ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
191 |
Z : 'H|K|N|O|P', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
192 |
Y : 'X|form|R|Q', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
193 |
ZG : 'E|span|width|align|char|charoff|valign', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
194 |
X : 'p|T|div|U|W|isindex|fieldset|table', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
195 |
ZF : 'E|align|char|charoff|valign', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
196 |
W : 'pre|hr|blockquote|address|center|noframes', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
197 |
ZE : 'abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
198 |
ZD : '[E][S]', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
199 |
U : 'ul|ol|dl|menu|dir', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
200 |
ZC : 'p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
201 |
T : 'h1|h2|h3|h4|h5|h6', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
202 |
ZB : 'X|S|Q', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
203 |
S : 'R|P', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
204 |
ZA : 'a|G|J|M|O|P', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
205 |
R : 'a|H|K|N|O', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
206 |
Q : 'noscript|P', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
207 |
P : 'ins|del|script', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
208 |
O : 'input|select|textarea|label|button', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
209 |
N : 'M|L', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
210 |
M : 'em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
211 |
L : 'sub|sup', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
212 |
K : 'J|I', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
213 |
J : 'tt|i|b|u|s|strike', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
214 |
I : 'big|small|font|basefont', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
215 |
H : 'G|F', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
216 |
G : 'br|span|bdo', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
217 |
F : 'object|applet|img|map|iframe', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
218 |
E : 'A|B|C', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
219 |
D : 'accesskey|tabindex|onfocus|onblur', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
220 |
C : 'onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
221 |
B : 'lang|xml:lang|dir', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
222 |
A : 'id|class|style|title' |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
223 |
}, 'script[id|charset|type|language|src|defer|xml:space][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
224 |
'style[B|id|type|media|title|xml:space][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
225 |
'object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
226 |
'param[id|name|value|valuetype|type][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
227 |
'p[E|align][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
228 |
'a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
229 |
'br[A|clear][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
230 |
'span[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
231 |
'bdo[A|C|B][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
232 |
'applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
233 |
'h1[E|align][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
234 |
'img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
235 |
'map[B|C|A|name][X|form|Q|area]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
236 |
'h2[E|align][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
237 |
'iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
238 |
'h3[E|align][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
239 |
'tt[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
240 |
'i[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
241 |
'b[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
242 |
'u[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
243 |
's[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
244 |
'strike[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
245 |
'big[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
246 |
'small[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
247 |
'font[A|B|size|color|face][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
248 |
'basefont[id|size|color|face][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
249 |
'em[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
250 |
'strong[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
251 |
'dfn[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
252 |
'code[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
253 |
'q[E|cite][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
254 |
'samp[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
255 |
'kbd[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
256 |
'var[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
257 |
'cite[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
258 |
'abbr[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
259 |
'acronym[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
260 |
'sub[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
261 |
'sup[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
262 |
'input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
263 |
'select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
264 |
'optgroup[E|disabled|label][option]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
265 |
'option[E|selected|disabled|label|value][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
266 |
'textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
267 |
'label[E|for|accesskey|onfocus|onblur][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
268 |
'button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
269 |
'h4[E|align][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
270 |
'ins[E|cite|datetime][#|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
271 |
'h5[E|align][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
272 |
'del[E|cite|datetime][#|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
273 |
'h6[E|align][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
274 |
'div[E|align][#|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
275 |
'ul[E|type|compact][li]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
276 |
'li[E|type|value][#|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
277 |
'ol[E|type|compact|start][li]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
278 |
'dl[E|compact][dt|dd]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
279 |
'dt[E][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
280 |
'dd[E][#|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
281 |
'menu[E|compact][li]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
282 |
'dir[E|compact][li]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
283 |
'pre[E|width|xml:space][#|ZA]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
284 |
'hr[E|align|noshade|size|width][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
285 |
'blockquote[E|cite][#|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
286 |
'address[E][#|S|p]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
287 |
'center[E][#|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
288 |
'noframes[E][#|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
289 |
'isindex[A|B|prompt][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
290 |
'fieldset[E][#|legend|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
291 |
'legend[E|accesskey|align][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
292 |
'table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
293 |
'caption[E|align][#|S]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
294 |
'col[ZG][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
295 |
'colgroup[ZG][col]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
296 |
'thead[ZF][tr]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
297 |
'tr[ZF|bgcolor][th|td]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
298 |
'th[E|ZE][#|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
299 |
'form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
300 |
'noscript[E][#|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
301 |
'td[E|ZE][#|Y]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
302 |
'tfoot[ZF][tr]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
303 |
'tbody[ZF][tr]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
304 |
'area[E|D|shape|coords|href|nohref|alt|target][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
305 |
'base[id|href|target][]' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
306 |
'body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]' |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
307 |
); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
308 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
309 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
310 |
return html4; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
311 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
312 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
313 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
314 |
* WordPress Core |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
315 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
316 |
* Returns a schema that is the result of a deep merge between the HTML5 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
317 |
* and HTML4 schemas. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
318 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
319 |
function getSaneSchema() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
320 |
var cachedMapCache = mapCache, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
321 |
html5, html4; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
322 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
323 |
if ( mapCache.sane ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
324 |
return mapCache.sane; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
325 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
326 |
// Bust the mapCache so we're not dealing with the other schema objects. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
327 |
mapCache = {}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
328 |
html5 = getHTML5(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
329 |
html4 = getHTML4(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
330 |
mapCache = cachedMapCache; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
331 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
332 |
each( html4, function( html4settings, tag ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
333 |
var html5settings = html5[ tag ], |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
334 |
difference = []; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
335 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
336 |
// Merge tags missing in HTML5 mode. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
337 |
if ( ! html5settings ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
338 |
html5[ tag ] = html4settings; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
339 |
return; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
340 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
341 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
342 |
// Merge attributes missing from this HTML5 tag. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
343 |
each( html4settings.attributes, function( attribute, key ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
344 |
if ( ! html5settings.attributes[ key ] ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
345 |
html5settings.attributes[ key ] = attribute; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
346 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
347 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
348 |
// Merge any missing attributes into the attributes order. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
349 |
each( html4settings.attributesOrder, function( key ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
350 |
if ( -1 === tinymce.inArray( html5settings.attributesOrder, key ) ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
351 |
difference.push( key ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
352 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
353 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
354 |
html5settings.attributesOrder = html5settings.attributesOrder.concat( difference ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
355 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
356 |
// Merge children missing from this HTML5 tag. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
357 |
each( html4settings.children, function( child, key ) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
358 |
if ( ! html5settings.children[ key ] ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
359 |
html5settings.children[ key ] = child; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
360 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
361 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
362 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
363 |
return mapCache.sane = html5; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
364 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
365 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
366 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
367 |
* Schema validator class. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
368 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
369 |
* @class tinymce.html.Schema |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
370 |
* @example |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
371 |
* if (tinymce.activeEditor.schema.isValidChild('p', 'span')) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
372 |
* alert('span is valid child of p.'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
373 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
374 |
* if (tinymce.activeEditor.schema.getElementRule('p')) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
375 |
* alert('P is a valid element.'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
376 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
377 |
* @class tinymce.html.Schema |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
378 |
* @version 3.4 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
379 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
380 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
381 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
382 |
* Constructs a new Schema instance. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
383 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
384 |
* @constructor |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
385 |
* @method Schema |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
386 |
* @param {Object} settings Name/value settings object. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
387 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
388 |
tinymce.html.Schema = function(settings) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
389 |
var self = this, elements = {}, children = {}, patternElements = [], validStyles, schemaItems; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
390 |
var whiteSpaceElementsMap, selfClosingElementsMap, shortEndedElementsMap, boolAttrMap, blockElementsMap, nonEmptyElementsMap, customElementsMap = {}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
391 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
392 |
// Creates an lookup table map object for the specified option or the default value |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
393 |
function createLookupTable(option, default_value, extend) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
394 |
var value = settings[option]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
395 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
396 |
if (!value) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
397 |
// Get cached default map or make it if needed |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
398 |
value = mapCache[option]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
399 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
400 |
if (!value) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
401 |
value = makeMap(default_value, ' ', makeMap(default_value.toUpperCase(), ' ')); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
402 |
value = tinymce.extend(value, extend); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
403 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
404 |
mapCache[option] = value; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
405 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
406 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
407 |
// Create custom map |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
408 |
value = makeMap(value, ',', makeMap(value.toUpperCase(), ' ')); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
409 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
410 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
411 |
return value; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
412 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
413 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
414 |
settings = settings || {}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
415 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
416 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
417 |
* WordPress core uses a sane schema in place of the default "HTML5" schema. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
418 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
419 |
schemaItems = settings.schema == "html5" ? getSaneSchema() : getHTML4(); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
420 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
421 |
// Allow all elements and attributes if verify_html is set to false |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
422 |
if (settings.verify_html === false) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
423 |
settings.valid_elements = '*[*]'; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
424 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
425 |
// Build styles list |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
426 |
if (settings.valid_styles) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
427 |
validStyles = {}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
428 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
429 |
// Convert styles into a rule list |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
430 |
each(settings.valid_styles, function(value, key) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
431 |
validStyles[key] = tinymce.explode(value); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
432 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
433 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
434 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
435 |
// Setup map objects |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
436 |
whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script noscript style textarea'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
437 |
selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
438 |
shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link meta param embed source wbr'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
439 |
boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
440 |
nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object', shortEndedElementsMap); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
441 |
textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
442 |
'blockquote center dir fieldset header footer article section hgroup aside nav figure'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
443 |
blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' + |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
444 |
'th tr td li ol ul caption dl dt dd noscript menu isindex samp option datalist select optgroup', textBlockElementsMap); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
445 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
446 |
// Converts a wildcard expression string to a regexp for example *a will become /.*a/. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
447 |
function patternToRegExp(str) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
448 |
return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
449 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
450 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
451 |
// Parses the specified valid_elements string and adds to the current rules |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
452 |
// This function is a bit hard to read since it's heavily optimized for speed |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
453 |
function addValidElements(valid_elements) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
454 |
var ei, el, ai, al, yl, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
455 |
prefix, outputName, globalAttributes, globalAttributesOrder, transElement, key, childKey, value, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
456 |
elementRuleRegExp = /^([#+\-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
457 |
attrRuleRegExp = /^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
458 |
hasPatternsRegExp = /[*?+]/; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
459 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
460 |
if (valid_elements) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
461 |
// Split valid elements into an array with rules |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
462 |
valid_elements = split(valid_elements); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
463 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
464 |
if (elements['@']) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
465 |
globalAttributes = elements['@'].attributes; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
466 |
globalAttributesOrder = elements['@'].attributesOrder; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
467 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
468 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
469 |
// Loop all rules |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
470 |
for (ei = 0, el = valid_elements.length; ei < el; ei++) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
471 |
// Parse element rule |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
472 |
matches = elementRuleRegExp.exec(valid_elements[ei]); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
473 |
if (matches) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
474 |
// Setup local names for matches |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
475 |
prefix = matches[1]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
476 |
elementName = matches[2]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
477 |
outputName = matches[3]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
478 |
attrData = matches[4]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
479 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
480 |
// Create new attributes and attributesOrder |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
481 |
attributes = {}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
482 |
attributesOrder = []; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
483 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
484 |
// Create the new element |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
485 |
element = { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
486 |
attributes : attributes, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
487 |
attributesOrder : attributesOrder |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
488 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
489 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
490 |
// Padd empty elements prefix |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
491 |
if (prefix === '#') |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
492 |
element.paddEmpty = true; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
493 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
494 |
// Remove empty elements prefix |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
495 |
if (prefix === '-') |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
496 |
element.removeEmpty = true; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
497 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
498 |
// Copy attributes from global rule into current rule |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
499 |
if (globalAttributes) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
500 |
for (key in globalAttributes) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
501 |
attributes[key] = globalAttributes[key]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
502 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
503 |
attributesOrder.push.apply(attributesOrder, globalAttributesOrder); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
504 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
505 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
506 |
// Attributes defined |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
507 |
if (attrData) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
508 |
attrData = split(attrData, '|'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
509 |
for (ai = 0, al = attrData.length; ai < al; ai++) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
510 |
matches = attrRuleRegExp.exec(attrData[ai]); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
511 |
if (matches) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
512 |
attr = {}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
513 |
attrType = matches[1]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
514 |
attrName = matches[2].replace(/::/g, ':'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
515 |
prefix = matches[3]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
516 |
value = matches[4]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
517 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
518 |
// Required |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
519 |
if (attrType === '!') { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
520 |
element.attributesRequired = element.attributesRequired || []; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
521 |
element.attributesRequired.push(attrName); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
522 |
attr.required = true; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
523 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
524 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
525 |
// Denied from global |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
526 |
if (attrType === '-') { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
527 |
delete attributes[attrName]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
528 |
attributesOrder.splice(tinymce.inArray(attributesOrder, attrName), 1); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
529 |
continue; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
530 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
531 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
532 |
// Default value |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
533 |
if (prefix) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
534 |
// Default value |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
535 |
if (prefix === '=') { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
536 |
element.attributesDefault = element.attributesDefault || []; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
537 |
element.attributesDefault.push({name: attrName, value: value}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
538 |
attr.defaultValue = value; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
539 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
540 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
541 |
// Forced value |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
542 |
if (prefix === ':') { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
543 |
element.attributesForced = element.attributesForced || []; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
544 |
element.attributesForced.push({name: attrName, value: value}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
545 |
attr.forcedValue = value; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
546 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
547 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
548 |
// Required values |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
549 |
if (prefix === '<') |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
550 |
attr.validValues = makeMap(value, '?'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
551 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
552 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
553 |
// Check for attribute patterns |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
554 |
if (hasPatternsRegExp.test(attrName)) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
555 |
element.attributePatterns = element.attributePatterns || []; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
556 |
attr.pattern = patternToRegExp(attrName); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
557 |
element.attributePatterns.push(attr); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
558 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
559 |
// Add attribute to order list if it doesn't already exist |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
560 |
if (!attributes[attrName]) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
561 |
attributesOrder.push(attrName); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
562 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
563 |
attributes[attrName] = attr; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
564 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
565 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
566 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
567 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
568 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
569 |
// Global rule, store away these for later usage |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
570 |
if (!globalAttributes && elementName == '@') { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
571 |
globalAttributes = attributes; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
572 |
globalAttributesOrder = attributesOrder; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
573 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
574 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
575 |
// Handle substitute elements such as b/strong |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
576 |
if (outputName) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
577 |
element.outputName = elementName; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
578 |
elements[outputName] = element; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
579 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
580 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
581 |
// Add pattern or exact element |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
582 |
if (hasPatternsRegExp.test(elementName)) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
583 |
element.pattern = patternToRegExp(elementName); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
584 |
patternElements.push(element); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
585 |
} else |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
586 |
elements[elementName] = element; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
587 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
588 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
589 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
590 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
591 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
592 |
function setValidElements(valid_elements) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
593 |
elements = {}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
594 |
patternElements = []; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
595 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
596 |
addValidElements(valid_elements); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
597 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
598 |
each(schemaItems, function(element, name) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
599 |
children[name] = element.children; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
600 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
601 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
602 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
603 |
// Adds custom non HTML elements to the schema |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
604 |
function addCustomElements(custom_elements) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
605 |
var customElementRegExp = /^(~)?(.+)$/; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
606 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
607 |
if (custom_elements) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
608 |
each(split(custom_elements), function(rule) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
609 |
var matches = customElementRegExp.exec(rule), |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
610 |
inline = matches[1] === '~', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
611 |
cloneName = inline ? 'span' : 'div', |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
612 |
name = matches[2]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
613 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
614 |
children[name] = children[cloneName]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
615 |
customElementsMap[name] = cloneName; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
616 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
617 |
// If it's not marked as inline then add it to valid block elements |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
618 |
if (!inline) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
619 |
blockElementsMap[name.toUpperCase()] = {}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
620 |
blockElementsMap[name] = {}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
621 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
622 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
623 |
// Add elements clone if needed |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
624 |
if (!elements[name]) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
625 |
elements[name] = elements[cloneName]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
626 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
627 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
628 |
// Add custom elements at span/div positions |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
629 |
each(children, function(element, child) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
630 |
if (element[cloneName]) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
631 |
element[name] = element[cloneName]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
632 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
633 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
634 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
635 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
636 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
637 |
// Adds valid children to the schema object |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
638 |
function addValidChildren(valid_children) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
639 |
var childRuleRegExp = /^([+\-]?)(\w+)\[([^\]]+)\]$/; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
640 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
641 |
if (valid_children) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
642 |
each(split(valid_children), function(rule) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
643 |
var matches = childRuleRegExp.exec(rule), parent, prefix; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
644 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
645 |
if (matches) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
646 |
prefix = matches[1]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
647 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
648 |
// Add/remove items from default |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
649 |
if (prefix) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
650 |
parent = children[matches[2]]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
651 |
else |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
652 |
parent = children[matches[2]] = {'#comment' : {}}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
653 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
654 |
parent = children[matches[2]]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
655 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
656 |
each(split(matches[3], '|'), function(child) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
657 |
if (prefix === '-') |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
658 |
delete parent[child]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
659 |
else |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
660 |
parent[child] = {}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
661 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
662 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
663 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
664 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
665 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
666 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
667 |
function getElementRule(name) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
668 |
var element = elements[name], i; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
669 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
670 |
// Exact match found |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
671 |
if (element) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
672 |
return element; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
673 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
674 |
// No exact match then try the patterns |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
675 |
i = patternElements.length; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
676 |
while (i--) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
677 |
element = patternElements[i]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
678 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
679 |
if (element.pattern.test(name)) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
680 |
return element; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
681 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
682 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
683 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
684 |
if (!settings.valid_elements) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
685 |
// No valid elements defined then clone the elements from the schema spec |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
686 |
each(schemaItems, function(element, name) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
687 |
elements[name] = { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
688 |
attributes : element.attributes, |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
689 |
attributesOrder : element.attributesOrder |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
690 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
691 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
692 |
children[name] = element.children; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
693 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
694 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
695 |
// Switch these on HTML4 |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
696 |
if (settings.schema != "html5") { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
697 |
each(split('strong/b,em/i'), function(item) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
698 |
item = split(item, '/'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
699 |
elements[item[1]].outputName = item[0]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
700 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
701 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
702 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
703 |
// Add default alt attribute for images |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
704 |
elements.img.attributesDefault = [{name: 'alt', value: ''}]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
705 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
706 |
// Remove these if they are empty by default |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
707 |
each(split('ol,ul,sub,sup,blockquote,span,font,a,table,tbody,tr,strong,em,b,i'), function(name) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
708 |
if (elements[name]) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
709 |
elements[name].removeEmpty = true; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
710 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
711 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
712 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
713 |
// Padd these by default |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
714 |
each(split('p,h1,h2,h3,h4,h5,h6,th,td,pre,div,address,caption'), function(name) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
715 |
elements[name].paddEmpty = true; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
716 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
717 |
} else |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
718 |
setValidElements(settings.valid_elements); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
719 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
720 |
addCustomElements(settings.custom_elements); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
721 |
addValidChildren(settings.valid_children); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
722 |
addValidElements(settings.extended_valid_elements); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
723 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
724 |
// Todo: Remove this when we fix list handling to be valid |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
725 |
addValidChildren('+ol[ul|ol],+ul[ul|ol]'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
726 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
727 |
// Delete invalid elements |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
728 |
if (settings.invalid_elements) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
729 |
tinymce.each(tinymce.explode(settings.invalid_elements), function(item) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
730 |
if (elements[item]) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
731 |
delete elements[item]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
732 |
}); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
733 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
734 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
735 |
// If the user didn't allow span only allow internal spans |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
736 |
if (!getElementRule('span')) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
737 |
addValidElements('span[!data-mce-type|*]'); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
738 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
739 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
740 |
* Name/value map object with valid parents and children to those parents. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
741 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
742 |
* @example |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
743 |
* children = { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
744 |
* div:{p:{}, h1:{}} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
745 |
* }; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
746 |
* @field children |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
747 |
* @type {Object} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
748 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
749 |
self.children = children; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
750 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
751 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
752 |
* Name/value map object with valid styles for each element. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
753 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
754 |
* @field styles |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
755 |
* @type {Object} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
756 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
757 |
self.styles = validStyles; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
758 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
759 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
760 |
* Returns a map with boolean attributes. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
761 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
762 |
* @method getBoolAttrs |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
763 |
* @return {Object} Name/value lookup map for boolean attributes. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
764 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
765 |
self.getBoolAttrs = function() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
766 |
return boolAttrMap; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
767 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
768 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
769 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
770 |
* Returns a map with block elements. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
771 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
772 |
* @method getBlockElements |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
773 |
* @return {Object} Name/value lookup map for block elements. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
774 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
775 |
self.getBlockElements = function() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
776 |
return blockElementsMap; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
777 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
778 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
779 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
780 |
* Returns a map with text block elements. Such as: p,h1-h6,div,address |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
781 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
782 |
* @method getTextBlockElements |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
783 |
* @return {Object} Name/value lookup map for block elements. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
784 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
785 |
self.getTextBlockElements = function() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
786 |
return textBlockElementsMap; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
787 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
788 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
789 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
790 |
* Returns a map with short ended elements such as BR or IMG. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
791 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
792 |
* @method getShortEndedElements |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
793 |
* @return {Object} Name/value lookup map for short ended elements. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
794 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
795 |
self.getShortEndedElements = function() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
796 |
return shortEndedElementsMap; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
797 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
798 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
799 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
800 |
* Returns a map with self closing tags such as <li>. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
801 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
802 |
* @method getSelfClosingElements |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
803 |
* @return {Object} Name/value lookup map for self closing tags elements. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
804 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
805 |
self.getSelfClosingElements = function() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
806 |
return selfClosingElementsMap; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
807 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
808 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
809 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
810 |
* Returns a map with elements that should be treated as contents regardless if it has text |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
811 |
* content in them or not such as TD, VIDEO or IMG. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
812 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
813 |
* @method getNonEmptyElements |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
814 |
* @return {Object} Name/value lookup map for non empty elements. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
815 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
816 |
self.getNonEmptyElements = function() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
817 |
return nonEmptyElementsMap; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
818 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
819 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
820 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
821 |
* Returns a map with elements where white space is to be preserved like PRE or SCRIPT. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
822 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
823 |
* @method getWhiteSpaceElements |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
824 |
* @return {Object} Name/value lookup map for white space elements. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
825 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
826 |
self.getWhiteSpaceElements = function() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
827 |
return whiteSpaceElementsMap; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
828 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
829 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
830 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
831 |
* Returns true/false if the specified element and it's child is valid or not |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
832 |
* according to the schema. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
833 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
834 |
* @method isValidChild |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
835 |
* @param {String} name Element name to check for. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
836 |
* @param {String} child Element child to verify. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
837 |
* @return {Boolean} True/false if the element is a valid child of the specified parent. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
838 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
839 |
self.isValidChild = function(name, child) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
840 |
var parent = children[name]; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
841 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
842 |
return !!(parent && parent[child]); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
843 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
844 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
845 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
846 |
* Returns true/false if the specified element name and optional attribute is |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
847 |
* valid according to the schema. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
848 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
849 |
* @method isValid |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
850 |
* @param {String} name Name of element to check. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
851 |
* @param {String} attr Optional attribute name to check for. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
852 |
* @return {Boolean} True/false if the element and attribute is valid. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
853 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
854 |
self.isValid = function(name, attr) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
855 |
var attrPatterns, i, rule = getElementRule(name); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
856 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
857 |
// Check if it's a valid element |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
858 |
if (rule) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
859 |
if (attr) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
860 |
// Check if attribute name exists |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
861 |
if (rule.attributes[attr]) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
862 |
return true; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
863 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
864 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
865 |
// Check if attribute matches a regexp pattern |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
866 |
attrPatterns = rule.attributePatterns; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
867 |
if (attrPatterns) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
868 |
i = attrPatterns.length; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
869 |
while (i--) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
870 |
if (attrPatterns[i].pattern.test(name)) { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
871 |
return true; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
872 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
873 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
874 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
875 |
} else { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
876 |
return true; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
877 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
878 |
} |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
879 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
880 |
// No match |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
881 |
return false; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
882 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
883 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
884 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
885 |
* Returns true/false if the specified element is valid or not |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
886 |
* according to the schema. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
887 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
888 |
* @method getElementRule |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
889 |
* @param {String} name Element name to check for. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
890 |
* @return {Object} Element object or undefined if the element isn't valid. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
891 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
892 |
self.getElementRule = getElementRule; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
893 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
894 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
895 |
* Returns an map object of all custom elements. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
896 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
897 |
* @method getCustomElements |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
898 |
* @return {Object} Name/value map object of all custom elements. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
899 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
900 |
self.getCustomElements = function() { |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
901 |
return customElementsMap; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
902 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
903 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
904 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
905 |
* Parses a valid elements string and adds it to the schema. The valid elements format is for example "element[attr=default|otherattr]". |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
906 |
* Existing rules will be replaced with the ones specified, so this extends the schema. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
907 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
908 |
* @method addValidElements |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
909 |
* @param {String} valid_elements String in the valid elements format to be parsed. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
910 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
911 |
self.addValidElements = addValidElements; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
912 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
913 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
914 |
* Parses a valid elements string and sets it to the schema. The valid elements format is for example "element[attr=default|otherattr]". |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
915 |
* Existing rules will be replaced with the ones specified, so this extends the schema. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
916 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
917 |
* @method setValidElements |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
918 |
* @param {String} valid_elements String in the valid elements format to be parsed. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
919 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
920 |
self.setValidElements = setValidElements; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
921 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
922 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
923 |
* Adds custom non HTML elements to the schema. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
924 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
925 |
* @method addCustomElements |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
926 |
* @param {String} custom_elements Comma separated list of custom elements to add. |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
927 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
928 |
self.addCustomElements = addCustomElements; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
929 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
930 |
/** |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
931 |
* Parses a valid children string and adds them to the schema structure. The valid children format is for example: "element[child1|child2]". |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
932 |
* |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
933 |
* @method addValidChildren |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
934 |
* @param {String} valid_children Valid children elements string to parse |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
935 |
*/ |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
936 |
self.addValidChildren = addValidChildren; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
937 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
938 |
self.elements = elements; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
939 |
}; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
940 |
})(tinymce); |