| 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 | /** |