return node.type != CKEDITOR.NODE_TEXT\r
&& node.getName() in CKEDITOR.dtd.$removeEmpty\r
|| !CKEDITOR.tools.trim( node.getText() )\r
- || node.getParent().hasAttribute( '_fck_bookmark' );\r
+ || node.getParent().hasAttribute( '_cke_bookmark' );\r
}\r
\r
var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(),\r
var startNode, endNode;\r
var baseId;\r
var clone;\r
+ var collapsed = this.collapsed;\r
\r
startNode = this.document.createElement( 'span' );\r
- startNode.setAttribute( '_fck_bookmark', 1 );\r
+ startNode.setAttribute( '_cke_bookmark', 1 );\r
startNode.setStyle( 'display', 'none' );\r
\r
// For IE, it must have something inside, otherwise it may be\r
}\r
\r
// If collapsed, the endNode will not be created.\r
- if ( !this.collapsed )\r
+ if ( !collapsed )\r
{\r
endNode = startNode.clone();\r
endNode.setHtml( ' ' );\r
return {\r
startNode : serializable ? baseId + 'S' : startNode,\r
endNode : serializable ? baseId + 'E' : endNode,\r
- serializable : serializable\r
+ serializable : serializable,\r
+ collapsed : collapsed\r
};\r
},\r
\r
var startOffset = this.startOffset,\r
endOffset = this.endOffset;\r
\r
+ var collapsed = this.collapsed;\r
+\r
var child, previous;\r
\r
// If there is no range then get out of here.\r
}\r
\r
// Process the end only if not normalized.\r
- if ( !this.isCollapsed )\r
+ if ( !collapsed )\r
{\r
// Find out if the start is pointing to a text node that\r
// will be normalized.\r
\r
return {\r
start : startContainer.getAddress( normalized ),\r
- end : this.isCollapsed ? null : endContainer.getAddress( normalized ),\r
+ end : collapsed ? null : endContainer.getAddress( normalized ),\r
startOffset : startOffset,\r
endOffset : endOffset,\r
normalized : normalized,\r
+ collapsed : collapsed,\r
is2 : true // It's a createBookmark2 bookmark.\r
};\r
},\r
endNode = this.endContainer;\r
\r
if ( startNode.is && startNode.is( 'span' )\r
- && startNode.hasAttribute( '_fck_bookmark' ) )\r
+ && startNode.hasAttribute( '_cke_bookmark' ) )\r
this.setStartAt( startNode, CKEDITOR.POSITION_BEFORE_START );\r
if ( endNode && endNode.is && endNode.is( 'span' )\r
- && endNode.hasAttribute( '_fck_bookmark' ) )\r
+ && endNode.hasAttribute( '_cke_bookmark' ) )\r
this.setEndAt( endNode, CKEDITOR.POSITION_AFTER_END );\r
},\r
\r
// If this is a visible element.\r
// We need to check for the bookmark attribute because IE insists on\r
// rendering the display:none nodes we use for bookmarks. (#3363)\r
- if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_fck_bookmark' ) )\r
+ if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_cke_bookmark' ) )\r
{\r
// We'll accept it only if we need\r
// whitespace, and this is an inline\r
// If this is a visible element.\r
// We need to check for the bookmark attribute because IE insists on\r
// rendering the display:none nodes we use for bookmarks. (#3363)\r
- if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_fck_bookmark' ) )\r
+ if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_cke_bookmark' ) )\r
{\r
// We'll accept it only if we need\r
// whitespace, and this is an inline\r
},\r
\r
/**\r
- * Check whether current range is on the inner edge of the specified element.\r
- * @param {Number} checkType ( CKEDITOR.START | CKEDITOR.END ) The checking side.\r
+ * Check whether a range boundary is at the inner boundary of a given\r
+ * element.\r
* @param {CKEDITOR.dom.element} element The target element to check.\r
+ * @param {Number} checkType The boundary to check for both the range\r
+ * and the element. It can be CKEDITOR.START or CKEDITOR.END.\r
+ * @returns {Boolean} "true" if the range boundary is at the inner\r
+ * boundary of the element.\r
*/\r
checkBoundaryOfElement : function( element, checkType )\r
{\r
+ var checkStart = ( checkType == CKEDITOR.START );\r
+\r
+ // Create a copy of this range, so we can manipulate it for our checks.\r
var walkerRange = this.clone();\r
+\r
+ // Collapse the range at the proper size.\r
+ walkerRange.collapse( checkStart );\r
+\r
// Expand the range to element boundary.\r
- walkerRange[ checkType == CKEDITOR.START ?\r
- 'setStartAt' : 'setEndAt' ]\r
- ( element, checkType == CKEDITOR.START ?\r
- CKEDITOR.POSITION_AFTER_START\r
- : CKEDITOR.POSITION_BEFORE_END );\r
+ walkerRange[ checkStart ? 'setStartAt' : 'setEndAt' ]\r
+ ( element, checkStart ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_END );\r
\r
+ // Create the walker, which will check if we have anything useful\r
+ // in the range.\r
var walker = new CKEDITOR.dom.walker( walkerRange );\r
walker.evaluator = elementBoundaryEval;\r
- return walker[ checkType == CKEDITOR.START ?\r
- 'checkBackward' : 'checkForward' ]();\r
+\r
+ return walker[ checkStart ? 'checkBackward' : 'checkForward' ]();\r
},\r
\r
// Calls to this function may produce changes to the DOM. The range may\r