<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[23154] branches/3.5/wp-includes/js/tinymce: 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.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/23154">23154</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-12-10 10:12:47 +0000 (Mon, 10 Dec 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Restore the duck punch of TinyMCE's schema from <a href="http://core.trac.wordpress.org/changeset/23120">[23120]</a>, 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 <a href="http://core.trac.wordpress.org/ticket/22790">#22790</a>, <a href="http://core.trac.wordpress.org/ticket/22842">#22842</a>.

Merges <a href="http://core.trac.wordpress.org/changeset/23153">[23153]</a> to the 3.5 branch.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches35wpincludesjstinymcepluginswordpresseditor_plugin_srcjs">branches/3.5/wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js</a></li>
<li><a href="#branches35wpincludesjstinymcewptinymceschemajs">branches/3.5/wp-includes/js/tinymce/wp-tinymce-schema.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches35wpincludesjstinymcepluginswordpresseditor_plugin_srcjs"></a>
<div class="modfile"><h4>Modified: branches/3.5/wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js (23153 => 23154)</h4>
<pre class="diff"><span>
<span class="info">--- branches/3.5/wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js        2012-12-10 10:10:12 UTC (rev 23153)
+++ branches/3.5/wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js        2012-12-10 10:12:47 UTC (rev 23154)
</span><span class="lines">@@ -135,12 +135,6 @@
</span><span class="cx">                                 }
</span><span class="cx">                         });
</span><span class="cx"> 
</span><del>-                        // Extend &lt;object&gt; and &lt;embed&gt; (#WP22790)
-                        ed.onPreInit.add(function(ed) {
-                                ed.schema.addValidElements('object[*],param[id|name|value|valuetype|type],embed[*]');
-                                ed.schema.addValidChildren('+object[embed]');
-                        });
-
</del><span class="cx">                         ed.onInit.add(function(ed) {
</span><span class="cx">                                 var bodyClass = ed.getParam('body_class', ''), body = ed.getBody();
</span><span class="cx"> 
</span></span></pre></div>
<a id="branches35wpincludesjstinymcewptinymceschemajs"></a>
<div class="modfile"><h4>Modified: branches/3.5/wp-includes/js/tinymce/wp-tinymce-schema.js (23153 => 23154)</h4>
<pre class="diff"><span>
<span class="info">--- branches/3.5/wp-includes/js/tinymce/wp-tinymce-schema.js        2012-12-10 10:10:12 UTC (rev 23153)
+++ branches/3.5/wp-includes/js/tinymce/wp-tinymce-schema.js        2012-12-10 10:12:47 UTC (rev 23154)
</span><span class="lines">@@ -1,6 +1,8 @@
</span><span class="cx"> /**
</span><del>- * Schema.js
</del><ins>+ * TinyMCE Schema.js
</ins><span class="cx">  *
</span><ins>+ * Duck-punched by WordPress core to support a sane schema superset.
+ *
</ins><span class="cx">  * Copyright, Moxiecode Systems AB
</span><span class="cx">  * Released under LGPL License.
</span><span class="cx">  *
</span><span class="lines">@@ -56,22 +58,19 @@
</span><span class="cx"> 
</span><span class="cx">                 if (!html5) {
</span><span class="cx">                         html5 = mapCache.html5 = unpack({
</span><del>-                                        A : 'id|accesskey|class|dir|draggable|item|hidden|itemprop|role|spellcheck|style|subject|title|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup',
-                                        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|' +
-                                                'meter|noscript|object|output|progress|q|ruby|samp|script|select|small|span|strong|sub|sup|svg|textarea|time|var|video|wbr',
-                                        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|' +
-                                                '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|' +
-                                                'p|pre|progress|q|ruby|samp|script|section|select|small|span|strong|style|sub|sup|svg|table|textarea|time|ul|var|video'
</del><ins>+                                        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',
+                                        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',
+                                        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'
</ins><span class="cx">                                 }, 'html[A|manifest][body|head]' +
</span><span class="cx">                                         'head[A][base|command|link|meta|noscript|script|style|title]' +
</span><span class="cx">                                         'title[A][#]' +
</span><span class="cx">                                         'base[A|href|target][]' +
</span><del>-                                        'link[A|href|rel|media|type|sizes][]' +
</del><ins>+                                        'link[A|href|rel|media|type|sizes|crossorigin|hreflang][]' +
</ins><span class="cx">                                         'meta[A|http-equiv|name|content|charset][]' +
</span><span class="cx">                                         'style[A|type|media|scoped][#]' +
</span><del>-                                        'script[A|charset|type|src|defer|async][#]' +
</del><ins>+                                        'script[A|charset|type|src|defer|async|crossorigin][#]' +
</ins><span class="cx">                                         'noscript[A][C]' +
</span><del>-                                        'body[A][C]' +
</del><ins>+                                        'body[A|onafterprint|onbeforeprint|onbeforeunload|onblur|onerror|onfocus|onfullscreenchange|onfullscreenerror|onhashchange|onload|onmessage|onoffline|ononline|onpagehide|onpageshow|onpopstate|onresize|onscroll|onstorage|onunload][C]' +
</ins><span class="cx">                                         'section[A][C]' +
</span><span class="cx">                                         'nav[A][C]' +
</span><span class="cx">                                         'article[A][C]' +
</span><span class="lines">@@ -89,18 +88,19 @@
</span><span class="cx">                                         'p[A][B]' +
</span><span class="cx">                                         'br[A][]' +
</span><span class="cx">                                         'pre[A][B]' +
</span><del>-                                        'dialog[A][dd|dt]' +
</del><ins>+                                        'dialog[A|open][C|dd|dt]' +
</ins><span class="cx">                                         'blockquote[A|cite][C]' +
</span><span class="cx">                                         'ol[A|start|reversed][li]' +
</span><span class="cx">                                         'ul[A][li]' +
</span><span class="cx">                                         'li[A|value][C]' +
</span><span class="cx">                                         'dl[A][dd|dt]' +
</span><del>-                                        'dt[A][B]' +
</del><ins>+                                        'dt[A][C|B]' +
</ins><span class="cx">                                         'dd[A][C]' +
</span><del>-                                        'a[A|href|target|ping|rel|media|type][B]' +
</del><ins>+                                        'a[A|href|target|download|ping|rel|media|type][C|B]' +
</ins><span class="cx">                                         'em[A][B]' +
</span><span class="cx">                                         'strong[A][B]' +
</span><span class="cx">                                         'small[A][B]' +
</span><ins>+                                        's[A][B]' +
</ins><span class="cx">                                         'cite[A][B]' +
</span><span class="cx">                                         'q[A|cite][B]' +
</span><span class="cx">                                         'dfn[A][B]' +
</span><span class="lines">@@ -113,6 +113,7 @@
</span><span class="cx">                                         'sup[A][B]' +
</span><span class="cx">                                         'i[A][B]' +
</span><span class="cx">                                         'b[A][B]' +
</span><ins>+                                        'u[A][B]' +
</ins><span class="cx">                                         'mark[A][B]' +
</span><span class="cx">                                         'progress[A|value|max][B]' +
</span><span class="cx">                                         'meter[A|value|min|max|low|high|optimum][B]' +
</span><span class="lines">@@ -120,45 +121,48 @@
</span><span class="cx">                                         'ruby[A][B|rt|rp]' +
</span><span class="cx">                                         'rt[A][B]' +
</span><span class="cx">                                         'rp[A][B]' +
</span><ins>+                                        'bdi[A][B]' +
</ins><span class="cx">                                         'bdo[A][B]' +
</span><span class="cx">                                         'span[A][B]' +
</span><del>-                                        'ins[A|cite|datetime][B]' +
-                                        'del[A|cite|datetime][B]' +
</del><ins>+                                        'ins[A|cite|datetime][C|B]' +
+                                        'del[A|cite|datetime][C|B]' +
</ins><span class="cx">                                         'figure[A][C|legend|figcaption]' +
</span><span class="cx">                                         'figcaption[A][C]' +
</span><del>-                                        'img[A|alt|src|height|width|usemap|ismap][]' +
-                                        'iframe[A|name|src|height|width|sandbox|seamless][]' +
</del><ins>+                                        'img[A|alt|src|srcset|crossorigin|usemap|ismap|width|height][]' +
+                                        'iframe[A|name|src|srcdoc|height|width|sandbox|seamless|allowfullscreen][C|B]' +
</ins><span class="cx">                                         'embed[A|src|height|width|type][]' +
</span><del>-                                        'object[A|data|type|height|width|usemap|name|form|classid][param]' +
</del><ins>+                                        'object[A|data|type|typemustmatch|name|usemap|form|width|height][C|B|param]' +
</ins><span class="cx">                                         'param[A|name|value][]' +
</span><del>-                                        'details[A|open][C|legend]' +
-                                        'command[A|type|label|icon|disabled|checked|radiogroup][]' +
</del><ins>+                                        'summary[A][B]' +
+                                        'details[A|open][C|legend|summary]' +
+                                        'command[A|type|label|icon|disabled|checked|radiogroup|command][]' +
</ins><span class="cx">                                         'menu[A|type|label][C|li]' +
</span><span class="cx">                                         'legend[A][C|B]' +
</span><span class="cx">                                         'div[A][C]' +
</span><span class="cx">                                         'source[A|src|type|media][]' +
</span><del>-                                        'audio[A|src|autobuffer|autoplay|loop|controls][source]' +
-                                        'video[A|src|autobuffer|autoplay|loop|controls|width|height|poster][source]' +
</del><ins>+                                        'track[A|kind|src|srclang|label|default][]' +
+                                        'audio[A|src|autobuffer|autoplay|loop|controls|crossorigin|preload|mediagroup|muted][C|source|track]' +
+                                        'video[A|src|autobuffer|autoplay|loop|controls|width|height|poster|crossorigin|preload|mediagroup|muted][C|source|track]' +
</ins><span class="cx">                                         'hr[A][]' +
</span><span class="cx">                                         'form[A|accept-charset|action|autocomplete|enctype|method|name|novalidate|target][C]' +
</span><span class="cx">                                         'fieldset[A|disabled|form|name][C|legend]' +
</span><span class="cx">                                         'label[A|form|for][B]' +
</span><del>-                                        'input[A|type|accept|alt|autocomplete|autofocus|checked|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|height|list|max|maxlength|min|' +
-                                                'multiple|pattern|placeholder|readonly|required|size|src|step|width|files|value|name][]' +
-                                        'button[A|autofocus|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|name|value|type][B]' +
-                                        'select[A|autofocus|disabled|form|multiple|name|size][option|optgroup]' +
</del><ins>+                                        '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][]' +
+                                        'button[A|autofocus|disabled|form|formaction|formenctype|formmethod|formnovalidate|formtarget|name|type|value][B]' +
+                                        'select[A|autofocus|disabled|form|multiple|name|required|size][option|optgroup]' +
+                                        'data[A|value][B]' +
</ins><span class="cx">                                         'datalist[A][B|option]' +
</span><span class="cx">                                         'optgroup[A|disabled|label][option]' +
</span><del>-                                        'option[A|disabled|selected|label|value][]' +
-                                        'textarea[A|autofocus|disabled|form|maxlength|name|placeholder|readonly|required|rows|cols|wrap][]' +
</del><ins>+                                        'option[A|disabled|selected|label|value][#]' +
+                                        'textarea[A|autocomplete|autofocus|cols|dirname|disabled|form|inputmode|maxlength|name|placeholder|readonly|required|rows|wrap][#]' +
</ins><span class="cx">                                         'keygen[A|autofocus|challenge|disabled|form|keytype|name][]' +
</span><span class="cx">                                         'output[A|for|form|name][B]' +
</span><del>-                                        'canvas[A|width|height][]' +
-                                        'map[A|name][B|C]' +
-                                        'area[A|shape|coords|href|alt|target|media|rel|ping|type][]' +
-                                        'mathml[A][]' +
</del><ins>+                                        'canvas[A|width|height][a|button|input]' +
+                                        'map[A|name][C|B]' +
+                                        'area[A|alt|coords|shape|href|target|download|ping|rel|media|hreflang|type][]' +
+                                        'math[A][]' +
</ins><span class="cx">                                         'svg[A][]' +
</span><del>-                                        'table[A|border][caption|colgroup|thead|tfoot|tbody|tr]' +
</del><ins>+                                        'table[A][caption|colgroup|thead|tfoot|tbody|tr]' +
</ins><span class="cx">                                         'caption[A][C]' +
</span><span class="cx">                                         'colgroup[A|span][col]' +
</span><span class="cx">                                         'col[A|span][]' +
</span><span class="lines">@@ -166,7 +170,7 @@
</span><span class="cx">                                         'tfoot[A][tr]' +
</span><span class="cx">                                         'tbody[A][tr]' +
</span><span class="cx">                                         'tr[A][th|td]' +
</span><del>-                                        'th[A|headers|rowspan|colspan|scope][B]' +
</del><ins>+                                        'th[A|headers|rowspan|colspan|scope][C]' +
</ins><span class="cx">                                         'td[A|headers|rowspan|colspan][C]' +
</span><span class="cx">                                         'wbr[A][]'
</span><span class="cx">                         );
</span><span class="lines">@@ -307,6 +311,59 @@
</span><span class="cx">         };
</span><span class="cx"> 
</span><span class="cx">         /**
</span><ins>+         * WordPress Core
+         *
+         * Returns a schema that is the result of a deep merge between the HTML5
+         * and HTML4 schemas.
+         */
+        function getSaneSchema() {
+                var cachedMapCache = mapCache,
+                        html5, html4;
+
+                if ( mapCache.sane )
+                        return mapCache.sane;
+
+                // Bust the mapCache so we're not dealing with the other schema objects.
+                mapCache = {};
+                html5 = getHTML5();
+                html4 = getHTML4();
+                mapCache = cachedMapCache;
+
+                each( html4, function( html4settings, tag ) {
+                        var html5settings = html5[ tag ],
+                                difference = [];
+
+                        // Merge tags missing in HTML5 mode.
+                        if ( ! html5settings ) {
+                                html5[ tag ] = html4settings;
+                                return;
+                        }
+
+                        // Merge attributes missing from this HTML5 tag.
+                        each( html4settings.attributes, function( attribute, key ) {
+                                if ( ! html5settings.attributes[ key ] )
+                                        html5settings.attributes[ key ] = attribute;
+                        });
+
+                        // Merge any missing attributes into the attributes order.
+                        each( html4settings.attributesOrder, function( key ) {
+                                if ( -1 === tinymce.inArray( html5settings.attributesOrder, key ) )
+                                        difference.push( key );
+                        });
+
+                        html5settings.attributesOrder = html5settings.attributesOrder.concat( difference );
+
+                        // Merge children missing from this HTML5 tag.
+                        each( html4settings.children, function( child, key ) {
+                                if ( ! html5settings.children[ key ] )
+                                        html5settings.children[ key ] = child;
+                        });
+                });
+
+                return mapCache.sane = html5;
+        }
+
+        /**
</ins><span class="cx">          * Schema validator class.
</span><span class="cx">          *
</span><span class="cx">          * @class tinymce.html.Schema
</span><span class="lines">@@ -355,8 +412,12 @@
</span><span class="cx">                 };
</span><span class="cx"> 
</span><span class="cx">                 settings = settings || {};
</span><del>-                schemaItems = settings.schema == &quot;html5&quot; ? getHTML5() : getHTML4();
</del><span class="cx"> 
</span><ins>+                /**
+                 * WordPress core uses a sane schema in place of the default &quot;HTML5&quot; schema.
+                 */
+                schemaItems = settings.schema == &quot;html5&quot; ? getSaneSchema() : getHTML4();
+
</ins><span class="cx">                 // Allow all elements and attributes if verify_html is set to false
</span><span class="cx">                 if (settings.verify_html === false)
</span><span class="cx">                         settings.valid_elements = '*[*]';
</span></span></pre>
</div>
</div>

</body>
</html>