Make WordPress Core

Changeset 23153

Timestamp:
12/10/2012 10:10:12 AM (12 years ago)
Author:
nacin
Message:

Restore the duck punch of TinyMCE's schema from [23120], along with updated rules for all HTML5 elements, as painstakingly audited against the HTML5 spec.

Remove conflicting and unnecessary code in the WP TinyMCE plugin.

Fixes all known regressions when working with the embed, object, video, audio, source, and param elements in TinyMCE.

props markjaquith, koopersmith.
fixes #22790, #22842.
fixes #22842.

Location:
trunk/wp-includes/js/tinymce
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js

    r23144 r23153  
    134134                    }
    135135                }
    136             });
    137 
    138             // Extend <object> and <embed> (#WP22790)
    139             ed.onPreInit.add(function(ed) {
    140                 ed.schema.addValidElements('object[*],param[id|name|value|valuetype|type],embed[*]');
    141                 ed.schema.addValidChildren('+object[embed]');
    142136            });
    143137
  • trunk/wp-includes/js/tinymce/wp-tinymce-schema.js

    r23151 r23153  
    11/**
    2  * Schema.js
     2 * TinyMCE Schema.js
     3 *
     4 * Duck-punched by WordPress core to support a sane schema superset.
    35 *
    46 * Copyright, Moxiecode Systems AB
     
    5759        if (!html5) {
    5860            html5 = mapCache.html5 = unpack({
    59                     A : 'id|accesskey|class|dir|draggable|item|hidden|itemprop|role|spellcheck|style|subject|title|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup',
    60                     B : '#|a|abbr|area|audio|b|bdo|br|button|canvas|cite|code|command|datalist|del|dfn|em|embed|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|meta|' +
    61                         'meter|noscript|object|output|progress|q|ruby|samp|script|select|small|span|strong|sub|sup|svg|textarea|time|var|video|wbr',
    62                     C : '#|a|abbr|area|address|article|aside|audio|b|bdo|blockquote|br|button|canvas|cite|code|command|datalist|del|details|dfn|dialog|div|dl|em|embed|fieldset|' +
    63                         'figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|i|iframe|img|input|ins|kbd|keygen|label|link|map|mark|menu|meta|meter|nav|noscript|ol|object|output|' +
    64                         'p|pre|progress|q|ruby|samp|script|section|select|small|span|strong|style|sub|sup|svg|table|textarea|time|ul|var|video'
     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',
     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',
     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'
    6564                }, 'html[A|manifest][body|head]' +
    6665                    'head[A][base|command|link|meta|noscript|script|style|title]' +
    6766                    'title[A][#]' +
    6867                    'base[A|href|target][]' +
    69                     'link[A|href|rel|media|type|sizes][]' +
     68                    'link[A|href|rel|media|type|sizes][]' +
    7069                    'meta[A|http-equiv|name|content|charset][]' +
    7170                    'style[A|type|media|scoped][#]' +
    72                     'script[A|charset|type|src|defer|async][#]' +
     71                    'script[A|charset|type|src|defer|async][#]' +
    7372                    'noscript[A][C]' +
    74                     'body[A][C]' +
     73                    'body[A][C]' +
    7574                    'section[A][C]' +
    7675                    'nav[A][C]' +
     
    9089                    'br[A][]' +
    9190                    'pre[A][B]' +
    92                     'dialog[A][dd|dt]' +
     91                    'dialog[Add|dt]' +
    9392                    'blockquote[A|cite][C]' +
    9493                    'ol[A|start|reversed][li]' +
     
    9695                    'li[A|value][C]' +
    9796                    'dl[A][dd|dt]' +
    98                     'dt[A][B]' +
     97                    'dt[A][B]' +
    9998                    'dd[A][C]' +
    100                     'a[A|href|target|ping|rel|media|type][B]' +
     99                    'a[A|href|target|B]' +
    101100                    'em[A][B]' +
    102101                    'strong[A][B]' +
    103102                    'small[A][B]' +
     103
    104104                    'cite[A][B]' +
    105105                    'q[A|cite][B]' +
     
    114114                    'i[A][B]' +
    115115                    'b[A][B]' +
     116
    116117                    'mark[A][B]' +
    117118                    'progress[A|value|max][B]' +
     
    121122                    'rt[A][B]' +
    122123                    'rp[A][B]' +
     124
    123125                    'bdo[A][B]' +
    124126                    'span[A][B]' +
    125                     'ins[A|cite|datetime][B]' +
    126                     'del[A|cite|datetime][B]' +
     127                    'ins[A|cite|datetime][B]' +
     128                    'del[A|cite|datetime][B]' +
    127129                    'figure[A][C|legend|figcaption]' +
    128130                    'figcaption[A][C]' +
    129                     'img[A|alt|src|height|width|usemap|ismap][]' +
    130                     'iframe[A|name|src|height|width|sandbox|seamless][]' +
     131                    'img[A|alt|src|][]' +
     132                    'iframe[A|name|src|]' +
    131133                    'embed[A|src|height|width|type][]' +
    132                     'object[A|data|type|height|width|usemap|name|form|classid][param]' +
     134                    'object[A|data|type|param]' +
    133135                    'param[A|name|value][]' +
    134                     'details[A|open][C|legend]' +
    135                     'command[A|type|label|icon|disabled|checked|radiogroup][]' +
     136                    'summary[A][B]' +
     137                    'details[A|open][C|legend|summary]' +
     138                    'command[A|type|label|icon|disabled|checked|radiogroup|command][]' +
    136139                    'menu[A|type|label][C|li]' +
    137140                    'legend[A][C|B]' +
    138141                    'div[A][C]' +
    139142                    'source[A|src|type|media][]' +
    140                     'audio[A|src|autobuffer|autoplay|loop|controls][source]' +
    141                     'video[A|src|autobuffer|autoplay|loop|controls|width|height|poster][source]' +
     143                    'track[A|kind|src|srclang|label|default][]' +
     144                    'audio[A|src|autobuffer|autoplay|loop|controls|crossorigin|preload|mediagroup|muted][C|source|track]' +
     145                    'video[A|src|autobuffer|autoplay|loop|controls|width|height|poster|crossorigin|preload|mediagroup|muted][C|source|track]' +
    142146                    'hr[A][]' +
    143147                    'form[A|accept-charset|action|autocomplete|enctype|method|name|novalidate|target][C]' +
    144148                    'fieldset[A|disabled|form|name][C|legend]' +
    145149                    'label[A|form|for][B]' +
    146                     'input[A|type|accept|alt|autocomplete|autofocus|checked|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|height|list|max|maxlength|min|' +
    147                         'multiple|pattern|placeholder|readonly|required|size|src|step|width|files|value|name][]' +
    148                     'button[A|autofocus|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|name|value|type][B]' +
    149                     'select[A|autofocus|disabled|form|multiple|name|size][option|optgroup]' +
     150                    'input[A|type|accept|alt|autocomplete|autofocus|checked|di' +
     151                    ]' +
     152                    ']' +
     153                    ']' +
    150154                    'datalist[A][B|option]' +
    151155                    'optgroup[A|disabled|label][option]' +
    152                     'option[A|disabled|selected|label|value][]' +
    153                     'textarea[A|autofocus|disabled|form|maxlength|name|placeholder|readonly|required|rows|cols|wrap][]' +
     156                    'option[A|disabled|selected|label|value][]' +
     157                    'textarea[A|auto]' +
    154158                    'keygen[A|autofocus|challenge|disabled|form|keytype|name][]' +
    155159                    'output[A|for|form|name][B]' +
    156                     'canvas[A|width|height][]' +
    157                     'map[A|name][B|C]' +
    158                     'area[A|shape|coords|href|alt|target|media|rel|ping|type][]' +
    159                     'mathml[A][]' +
     160                    'canvas[A|width|height][]' +
     161                    'map[A|name][]' +
     162                    'area[A|ng|type][]' +
     163                    'math[A][]' +
    160164                    'svg[A][]' +
    161                     'table[A|border][caption|colgroup|thead|tfoot|tbody|tr]' +
     165                    'table[A][caption|colgroup|thead|tfoot|tbody|tr]' +
    162166                    'caption[A][C]' +
    163167                    'colgroup[A|span][col]' +
     
    167171                    'tbody[A][tr]' +
    168172                    'tr[A][th|td]' +
    169                     'th[A|headers|rowspan|colspan|scope][B]' +
     173                    'th[A|headers|rowspan|colspan|scope][]' +
    170174                    'td[A|headers|rowspan|colspan][C]' +
    171175                    'wbr[A][]'
     
    308312
    309313    /**
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
     324
     325
     326
     327
     328
     329
     330
     331
     332
     333
     334
     335
     336
     337
     338
     339
     340
     341
     342
     343
     344
     345
     346
     347
     348
     349
     350
     351
     352
     353
     354
     355
     356
     357
     358
     359
     360
     361
     362
     363
     364
     365
     366
    310367     * Schema validator class.
    311368     *
     
    356413
    357414        settings = settings || {};
    358         schemaItems = settings.schema == "html5" ? getHTML5() : getHTML4();
     415
     416        /**
     417         * WordPress core uses a sane schema in place of the default "HTML5" schema.
     418         */
     419        schemaItems = settings.schema == "html5" ? getSaneSchema() : getHTML4();
    359420
    360421        // Allow all elements and attributes if verify_html is set to false
Note: See TracChangeset for help on using the changeset viewer.