Index: plugins/htmldataprocessor/plugin.js
===================================================================
--- plugins/htmldataprocessor/plugin.js (revision 3524)
+++ plugins/htmldataprocessor/plugin.js (working copy)
@@ -7,12 +7,6 @@
{
var defaultDataFilterRules =
{
- elementNames :
- [
- // Elements that cause problems in wysiwyg mode.
- [ ( /^(object|embed|param)$/ ), 'cke:$1' ]
- ],
-
attributeNames :
[
// Event attributes (onXYZ) must not be directly set. They can become
@@ -105,11 +99,15 @@
}
var protectAttributeRegex = /<(?:a|area|img|input).*?\s((?:href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))/gi;
-
+ var protectElementNamesRegex = /(<[/]?)(object|embed|param)(.*?>)/gi;
function protectAttributes( html )
{
return html.replace( protectAttributeRegex, '$& _cke_saved_$1' );
}
+ function protectElementsNames( html )
+ {
+ return html.replace( protectElementNamesRegex, '$1cke:$2$3');
+ }
CKEDITOR.plugins.add( 'htmldataprocessor',
{
@@ -145,9 +143,13 @@
// the code.
data = protectAttributes( data );
+ // Certain elements has problem during native DOM operation, we transform them into
+ // their 'agent' intead, prefixing with 'cke:' to become a custom element.
+ data = protectElementsNames( data );
+
// Call the browser to help us fixing a possibly invalid HTML
// structure.
- var div = document.createElement( 'div' );
+ var div = document.createElement( 'body' );
div.innerHTML = data;
// Now use our parser to make further fixes to the structure, as