X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fcore%2Fdom%2Fwalker.js;h=a4ed957dc2aaa4385b0a01a4121dd07524f4a4f5;hp=a9c4ebacb5b4cb0beacff21d490918e7fda39628;hb=fb481ba0a7d298e3e7b9034fcb9f2afdc6e8e796;hpb=6e682412d5cc0dfaedb376482e585bf2989c6863 diff --git a/_source/core/dom/walker.js b/_source/core/dom/walker.js index a9c4eba..a4ed957 100644 --- a/_source/core/dom/walker.js +++ b/_source/core/dom/walker.js @@ -413,8 +413,14 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { return function( node ) { - var isWhitespace = node && ( node.type == CKEDITOR.NODE_TEXT ) - && !CKEDITOR.tools.trim( node.getText() ); + var isWhitespace; + if ( node && node.type == CKEDITOR.NODE_TEXT ) + { + // whitespace, as well as the text cursor filler node we used in Webkit. (#9384) + isWhitespace = !CKEDITOR.tools.trim( node.getText() ) || + CKEDITOR.env.webkit && node.getText() == '\u200b'; + } + return !! ( isReject ^ isWhitespace ); }; }; @@ -428,13 +434,25 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var whitespace = CKEDITOR.dom.walker.whitespaces(); return function( node ) { - // Nodes that take no spaces in wysiwyg: - // 1. White-spaces but not including NBSP; - // 2. Empty inline elements, e.g. we're checking here - // 'offsetHeight' instead of 'offsetWidth' for properly excluding - // all sorts of empty paragraph, e.g.
. - var isInvisible = whitespace( node ) || node.is && !node.$.offsetHeight; - return !! ( isReject ^ isInvisible ); + var invisible; + + if ( whitespace( node ) ) + invisible = 1; + else + { + // Visibility should be checked on element. + if ( node.type == CKEDITOR.NODE_TEXT ) + node = node.getParent(); + + // Nodes that take no spaces in wysiwyg: + // 1. White-spaces but not including NBSP; + // 2. Empty inline elements, e.g. we're checking here + // 'offsetHeight' instead of 'offsetWidth' for properly excluding + // all sorts of empty paragraph, e.g.
. + invisible = !node.$.offsetHeight; + } + + return !! ( isReject ^ invisible ); }; };