X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2Fpackagist%2Fconnexionswing-ckeditor-component.git;a=blobdiff_plain;f=sources%2Fcore%2Fdom%2Fnode.js;fp=sources%2Fcore%2Fdom%2Fnode.js;h=7818b079d3eb4f8c682ec2834dd4da36947371ea;hp=5d791319a95f2f843846c31c9d338e04ef7df192;hb=3b35bd273a79f6b01fda7a246aed64aca147ea7a;hpb=7adcb81e4f83f98c468889aaa5a85558ba88c770 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 @@ /** - * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. + * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or http://ckeditor.com/license */ @@ -373,7 +373,7 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, { // The idea is - all empty text nodes will be virtually merged into their adjacent text nodes. // If an empty text node does not have an adjacent non-empty text node we can return -1 straight away, // because it and all its sibling text nodes will be merged into an empty text node and then totally ignored. - if ( normalized && current.nodeType == CKEDITOR.NODE_TEXT && !current.nodeValue ) { + if ( normalized && current.nodeType == CKEDITOR.NODE_TEXT && isEmpty( current ) ) { var adjacent = getAdjacentNonEmptyTextNode( current ) || getAdjacentNonEmptyTextNode( current, true ); if ( !adjacent ) @@ -382,7 +382,7 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, { do { // Bypass blank node and adjacent text nodes. - if ( normalized && current != this.$ && current.nodeType == CKEDITOR.NODE_TEXT && ( isNormalizing || !current.nodeValue ) ) + if ( normalized && current != this.$ && current.nodeType == CKEDITOR.NODE_TEXT && ( isNormalizing || isEmpty( current ) ) ) continue; index++; @@ -401,7 +401,12 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, { // If found a non-empty text node, then return it. // If not, then continue search. - return sibling.nodeValue ? sibling : getAdjacentNonEmptyTextNode( sibling, lookForward ); + return isEmpty( sibling ) ? getAdjacentNonEmptyTextNode( sibling, lookForward ) : sibling; + } + + // Checks whether a text node is empty or is FCSeq string (which will be totally removed when normalizing). + function isEmpty( textNode ) { + return !textNode.nodeValue || textNode.nodeValue == CKEDITOR.dom.selection.FILLING_CHAR_SEQUENCE; } },