Index: /CKEditor/branches/prototype/_source/core/htmlparser.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/htmlparser.js (revision 2916)
+++ /CKEditor/branches/prototype/_source/core/htmlparser.js (revision 2917)
@@ -33,5 +33,5 @@
(function()
{
- var attribsRegex = /([\w:]+)(?:=(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))?/g,
+ var attribsRegex = /([\w:]+)\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+))?/g,
emptyAttribs = {checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1};
@@ -155,5 +155,5 @@
{
var attName = attribMatch[1].toLowerCase(),
- attValue = attribMatch[2] || attribMatch[3] || attribMatch[4];
+ attValue = attribMatch[2] || attribMatch[3] || attribMatch[4] || '';
if ( !attValue && emptyAttribs[ attName ] )
Index: /CKEditor/branches/prototype/_source/core/htmlparser/element.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/htmlparser/element.js (revision 2916)
+++ /CKEditor/branches/prototype/_source/core/htmlparser/element.js (revision 2917)
@@ -55,9 +55,11 @@
isEmpty = !!dtd.$empty[ name ];
+ this.isEmpty = isEmpty;
+ this.isUnknown = !dtd[ name ];
+
/** @private */
this._ =
{
isBlockLike : isBlockLike,
- isEmpty : isEmpty,
hasInlineStarted : isEmpty || !isBlockLike
};
@@ -131,7 +133,7 @@
// Close the tag.
- writer.openTagClose( this.name, this._.isEmpty );
+ writer.openTagClose( this.name, this.isEmpty );
- if ( !this._.isEmpty )
+ if ( !this.isEmpty )
{
// Send children.
Index: /CKEditor/branches/prototype/_source/core/htmlparser/fragment.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/htmlparser/fragment.js (revision 2916)
+++ /CKEditor/branches/prototype/_source/core/htmlparser/fragment.js (revision 2917)
@@ -86,5 +86,5 @@
currentDtd = currentNode.name && CKEDITOR.dtd[ currentNode.name ];
- if ( ( !currentDtd || currentDtd[ pendingName ] ) && ( !newTagName || !pendingDtd || pendingDtd[ newTagName ] ) )
+ if ( ( !currentDtd || currentDtd[ pendingName ] ) && ( !newTagName || !pendingDtd || pendingDtd[ newTagName ] || !CKEDITOR.dtd[ newTagName ] ) )
{
// Get a clone for the pending element.
@@ -105,7 +105,12 @@
};
- parser.onTagOpen = function( tagName, attributes )
+ parser.onTagOpen = function( tagName, attributes, selfClosing )
{
var element = new CKEDITOR.htmlParser.element( tagName, attributes );
+
+ // "isEmpty" will be always "false" for unknown elements, so we
+ // must force it if the parser has identified it as a selfClosing tag.
+ if ( element.isUnknown && selfClosing )
+ element.isEmpty = true;
// This is a tag to be removed if empty, so do not add it immediately.
@@ -120,5 +125,5 @@
// If the element cannot be child of the current element.
- if ( !currentDtd[ tagName ] )
+ if ( !element.isUnknown && !currentNode.isUnknown && !currentDtd[ tagName ] )
{
// If this is the fragment node, just ignore this tag and add
@@ -130,5 +135,5 @@
// If the element name is the same as the current element name,
- // then just close the current one an append the new one to the
+ // then just close the current one and append the new one to the
// parent. This situation usually happens with
,
,
and
//
, specially in IE.
@@ -164,5 +169,5 @@
currentNode.add( element );
- if ( !element._.isEmpty )
+ if ( !element.isEmpty )
currentNode = element;
};
@@ -194,5 +199,5 @@
{
// If we didn't find any parent to be closed, let's check the
- // peding list.
+ // pending list.
for ( ; index < pendingInline.length ; index++ )
{
Index: /CKEditor/branches/prototype/_source/plugins/htmldataprocessor/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/htmldataprocessor/plugin.js (revision 2916)
+++ /CKEditor/branches/prototype/_source/plugins/htmldataprocessor/plugin.js (revision 2917)
@@ -26,26 +26,31 @@
init : function( editor, pluginPath )
{
- editor.dataProcessor =
- {
- toHtml : function( data )
- {
- // The source data is already HTML, so just return it as is.
- return data;
- },
-
- toDataFormat : function( element )
- {
- var writer = this.writer,
- fragment = CKEDITOR.htmlParser.fragment.fromHtml( element.getHtml() );
-
- writer.reset();
-
- fragment.writeHtml( writer );
-
- return writer.getHtml( true );
- },
-
- writer : new CKEDITOR.htmlWriter()
- };
+ editor.dataProcessor = new CKEDITOR.htmlDataProcessor();
}
});
+
+CKEDITOR.htmlDataProcessor = function()
+{
+ this.writer = new CKEDITOR.htmlWriter();
+};
+
+CKEDITOR.htmlDataProcessor.prototype =
+{
+ toHtml : function( data )
+ {
+ // The source data is already HTML, so just return it as is.
+ return data;
+ },
+
+ toDataFormat : function( element )
+ {
+ var writer = this.writer,
+ fragment = CKEDITOR.htmlParser.fragment.fromHtml( element.getHtml() );
+
+ writer.reset();
+
+ fragment.writeHtml( writer );
+
+ return writer.getHtml( true );
+ }
+};
Index: /CKEditor/branches/prototype/_source/tests/core/htmlparser/fragment.html
===================================================================
--- /CKEditor/branches/prototype/_source/tests/core/htmlparser/fragment.html (revision 2917)
+++ /CKEditor/branches/prototype/_source/tests/core/htmlparser/fragment.html (revision 2917)
@@ -0,0 +1,35 @@
+
+
+
+ CKEDITOR.htmlParser.fragment
+
+
+
+
+
+
+
+
Index: /CKEditor/branches/prototype/_source/tests/plugins/htmldataprocessor/htmldataprocessor.html
===================================================================
--- /CKEditor/branches/prototype/_source/tests/plugins/htmldataprocessor/htmldataprocessor.html (revision 2917)
+++ /CKEditor/branches/prototype/_source/tests/plugins/htmldataprocessor/htmldataprocessor.html (revision 2917)
@@ -0,0 +1,102 @@
+
+
+
+ Plugin: htmldataprocessor
+
+
+
+
+
+
+
+
+
Index: /CKEditor/branches/prototype/_source/tests/plugins/styles/styles.html
===================================================================
--- /CKEditor/branches/prototype/_source/tests/plugins/styles/styles.html (revision 2916)
+++ /CKEditor/branches/prototype/_source/tests/plugins/styles/styles.html (revision 2917)
@@ -2,5 +2,5 @@
- CKEDITOR.styles Plugin
+ Plugin: styles
Index: /CKEditor/branches/prototype/_source/tests/testall.html
===================================================================
--- /CKEditor/branches/prototype/_source/tests/testall.html (revision 2916)
+++ /CKEditor/branches/prototype/_source/tests/testall.html (revision 2917)
@@ -13,4 +13,9 @@
'core/ckeditor2',
'core/editor',
+ 'core/env',
+ 'core/event',
+ 'core/scriptloader',
+ 'core/tools',
+ 'core/xml',
'core/dom/document',
'core/dom/element',
@@ -18,9 +23,6 @@
'core/dom/range',
'core/dom/window',
- 'core/env',
- 'core/event',
- 'core/scriptloader',
- 'core/tools',
- 'core/xml',
+ 'core/htmlparser/fragment',
+ 'plugins/htmldataprocessor/htmldataprocessor',
'plugins/styles/styles'
];