diff options
Diffstat (limited to 'sources/core/dom/node.js')
-rw-r--r-- | sources/core/dom/node.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sources/core/dom/node.js b/sources/core/dom/node.js index 5d791319..7818b079 100644 --- a/sources/core/dom/node.js +++ b/sources/core/dom/node.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. |
3 | * For licensing, see LICENSE.md or http://ckeditor.com/license | 3 | * For licensing, see LICENSE.md or http://ckeditor.com/license |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -373,7 +373,7 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, { | |||
373 | // The idea is - all empty text nodes will be virtually merged into their adjacent text nodes. | 373 | // The idea is - all empty text nodes will be virtually merged into their adjacent text nodes. |
374 | // If an empty text node does not have an adjacent non-empty text node we can return -1 straight away, | 374 | // If an empty text node does not have an adjacent non-empty text node we can return -1 straight away, |
375 | // because it and all its sibling text nodes will be merged into an empty text node and then totally ignored. | 375 | // because it and all its sibling text nodes will be merged into an empty text node and then totally ignored. |
376 | if ( normalized && current.nodeType == CKEDITOR.NODE_TEXT && !current.nodeValue ) { | 376 | if ( normalized && current.nodeType == CKEDITOR.NODE_TEXT && isEmpty( current ) ) { |
377 | var adjacent = getAdjacentNonEmptyTextNode( current ) || getAdjacentNonEmptyTextNode( current, true ); | 377 | var adjacent = getAdjacentNonEmptyTextNode( current ) || getAdjacentNonEmptyTextNode( current, true ); |
378 | 378 | ||
379 | if ( !adjacent ) | 379 | if ( !adjacent ) |
@@ -382,7 +382,7 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, { | |||
382 | 382 | ||
383 | do { | 383 | do { |
384 | // Bypass blank node and adjacent text nodes. | 384 | // Bypass blank node and adjacent text nodes. |
385 | if ( normalized && current != this.$ && current.nodeType == CKEDITOR.NODE_TEXT && ( isNormalizing || !current.nodeValue ) ) | 385 | if ( normalized && current != this.$ && current.nodeType == CKEDITOR.NODE_TEXT && ( isNormalizing || isEmpty( current ) ) ) |
386 | continue; | 386 | continue; |
387 | 387 | ||
388 | index++; | 388 | index++; |
@@ -401,7 +401,12 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, { | |||
401 | 401 | ||
402 | // If found a non-empty text node, then return it. | 402 | // If found a non-empty text node, then return it. |
403 | // If not, then continue search. | 403 | // If not, then continue search. |
404 | return sibling.nodeValue ? sibling : getAdjacentNonEmptyTextNode( sibling, lookForward ); | 404 | return isEmpty( sibling ) ? getAdjacentNonEmptyTextNode( sibling, lookForward ) : sibling; |
405 | } | ||
406 | |||
407 | // Checks whether a text node is empty or is FCSeq string (which will be totally removed when normalizing). | ||
408 | function isEmpty( textNode ) { | ||
409 | return !textNode.nodeValue || textNode.nodeValue == CKEDITOR.dom.selection.FILLING_CHAR_SEQUENCE; | ||
405 | } | 410 | } |
406 | }, | 411 | }, |
407 | 412 | ||