Index: /CKEditor/trunk/CHANGES.html
===================================================================
--- /CKEditor/trunk/CHANGES.html (revision 7371)
+++ /CKEditor/trunk/CHANGES.html (revision 7372)
@@ -52,4 +52,5 @@
#7955 : [FF] Fix "Page Up"/"Page Down" in wysiwyg mode cause selection lost.
#8698 : Fix "Esc" shortcut key to close color picker dialog.
+ #8413 : Fix HTML comment nodes breaking content styling in table.
Index: /CKEditor/trunk/_source/core/dom/comment.js
===================================================================
--- /CKEditor/trunk/_source/core/dom/comment.js (revision 7371)
+++ /CKEditor/trunk/_source/core/dom/comment.js (revision 7372)
@@ -9,17 +9,30 @@
*/
-CKEDITOR.dom.comment = CKEDITOR.tools.createClass(
+/**
+ * Represents a DOM comment node.
+ * @constructor
+ * @augments CKEDITOR.dom.node
+ * @param {Object|String} comment A native DOM comment node or a string containing
+ * the text to use to create a new comment node.
+ * @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain
+ * the node in case of new node creation. Defaults to the current document.
+ * @example
+ * var nativeNode = document.createComment( 'Example' );
+ * var comment = CKEDITOR.dom.comment( nativeNode );
+ * @example
+ * var comment = CKEDITOR.dom.comment( 'Example' );
+ */
+CKEDITOR.dom.comment = function( comment, ownerDocument )
{
- base : CKEDITOR.dom.node,
+ if ( typeof comment == 'string' )
+ comment = ( ownerDocument ? ownerDocument.$ : document ).createComment( comment );
- $ : function( text, ownerDocument )
- {
- if ( typeof text == 'string' )
- text = ( ownerDocument ? ownerDocument.$ : document ).createComment( text );
+ CKEDITOR.dom.domObject.call( this, comment );
+};
- this.base( text );
- },
+CKEDITOR.dom.comment.prototype = new CKEDITOR.dom.node();
- proto :
+CKEDITOR.tools.extend( CKEDITOR.dom.comment.prototype,
+ /** @lends CKEDITOR.dom.comment.prototype */
{
type : CKEDITOR.NODE_COMMENT,
@@ -29,4 +42,3 @@
return '';
}
- }
-});
+ });
Index: /CKEditor/trunk/_source/core/dom/node.js
===================================================================
--- /CKEditor/trunk/_source/core/dom/node.js (revision 7371)
+++ /CKEditor/trunk/_source/core/dom/node.js (revision 7372)
@@ -24,19 +24,11 @@
if ( domNode )
{
- switch ( domNode.nodeType )
- {
- // Safari don't consider document as element node type. (#3389)
- case CKEDITOR.NODE_DOCUMENT :
- return new CKEDITOR.dom.document( domNode );
-
- case CKEDITOR.NODE_ELEMENT :
- return new CKEDITOR.dom.element( domNode );
-
- case CKEDITOR.NODE_TEXT :
- return new CKEDITOR.dom.text( domNode );
- }
-
- // Call the base constructor.
- CKEDITOR.dom.domObject.call( this, domNode );
+ var constructor = domNode.nodeType == CKEDITOR.NODE_DOCUMENT ? 'document'
+ : domNode.nodeType == CKEDITOR.NODE_ELEMENT ? 'element'
+ : domNode.nodeType == CKEDITOR.NODE_TEXT ? 'text'
+ : domNode.nodeType == CKEDITOR.NODE_COMMENT ? 'comment'
+ : 'domObject'; // Call the base constructor otherwise.
+
+ return new CKEDITOR.dom[ constructor ]( domNode );
}
Index: /CKEditor/trunk/_source/core/dom/range.js
===================================================================
--- /CKEditor/trunk/_source/core/dom/range.js (revision 7371)
+++ /CKEditor/trunk/_source/core/dom/range.js (revision 7372)
@@ -1015,5 +1015,10 @@
isWhiteSpace = false;
- if ( sibling.type == CKEDITOR.NODE_TEXT )
+ if ( sibling.type == CKEDITOR.NODE_COMMENT )
+ {
+ sibling = sibling.getPrevious();
+ continue;
+ }
+ else if ( sibling.type == CKEDITOR.NODE_TEXT )
{
siblingText = sibling.getText();