Ticket #22790: 22720.dynamic.tinymce.core.diff

File 22720.dynamic.tinymce.core.diff, 2.2 KB (added by koopersmith, 6 months ago)
  • jscripts/tiny_mce/classes/html/Schema.js

    diff --git a/jscripts/tiny_mce/classes/html/Schema.js b/jscripts/tiny_mce/classes/html/Schema.js
    index 92d5184..abbd22d 100644
    a b  
    307307        }; 
    308308 
    309309        /** 
     310         * WordPress Core 
     311         * 
     312         * Returns a schema that is the result of a deep merge between the HTML5 
     313         * and HTML4 schemas. 
     314         */ 
     315        function getSaneSchema() { 
     316                var cachedMapCache = mapCache, 
     317                        html5, html4; 
     318 
     319                if ( mapCache.sane ) 
     320                        return mapCache.sane; 
     321 
     322                // Bust the mapCache so we're not dealing with the other schema objects. 
     323                mapCache = {}; 
     324                html5 = getHTML5(); 
     325                html4 = getHTML4(); 
     326                mapCache = cachedMapCache; 
     327 
     328                each( html4, function( html4settings, tag ) { 
     329                        var html5settings = html5[ tag ], 
     330                                difference = []; 
     331 
     332                        // Merge tags missing in HTML5 mode. 
     333                        if ( ! html5settings ) { 
     334                                html5[ tag ] = html4settings; 
     335                                return; 
     336                        } 
     337 
     338                        // Merge attributes missing from this HTML5 tag. 
     339                        each( html4settings.attributes, function( attribute, key ) { 
     340                                if ( ! html5settings.attributes[ key ] ) 
     341                                        html5settings.attributes[ key ] = attribute; 
     342                        }); 
     343 
     344                        // Merge any missing attributes into the attributes order. 
     345                        each( html4settings.attributesOrder, function( key ) { 
     346                                if ( -1 === tinymce.inArray( html5settings.attributesOrder, key ) ) 
     347                                        difference.push( key ); 
     348                        }); 
     349 
     350                        html5settings.attributesOrder = html5settings.attributesOrder.concat( difference ); 
     351 
     352                        // Merge children missing from this HTML5 tag. 
     353                        each( html4settings.children, function( child, key ) { 
     354                                if ( ! html5settings.children[ key ] ) 
     355                                        html5settings.children[ key ] = child; 
     356                        }); 
     357                }); 
     358 
     359                return mapCache.sane = html5; 
     360        } 
     361 
     362        /** 
    310363         * Schema validator class. 
    311364         * 
    312365         * @class tinymce.html.Schema 
     
    355408                }; 
    356409 
    357410                settings = settings || {}; 
    358                 schemaItems = settings.schema == "html5" ? getHTML5() : getHTML4(); 
     411 
     412                /** 
     413                 * WordPress core uses a sane schema in place of the default "HTML5" schema. 
     414                 */ 
     415                schemaItems = settings.schema == "html5" ? getSaneSchema() : getHTML4(); 
    359416 
    360417                // Allow all elements and attributes if verify_html is set to false 
    361418                if (settings.verify_html === false)