- // Nodes that take no spaces in wysiwyg:\r
- // 1. White-spaces but not including NBSP;\r
- // 2. Empty inline elements, e.g. <b></b> we're checking here\r
- // 'offsetHeight' instead of 'offsetWidth' for properly excluding\r
- // all sorts of empty paragraph, e.g. <br />.\r
- var isInvisible = whitespace( node ) || node.is && !node.$.offsetHeight;\r
- return !! ( isReject ^ isInvisible );\r
+ var invisible;\r
+\r
+ if ( whitespace( node ) )\r
+ invisible = 1;\r
+ else\r
+ {\r
+ // Visibility should be checked on element.\r
+ if ( node.type == CKEDITOR.NODE_TEXT )\r
+ node = node.getParent();\r
+\r
+ // Nodes that take no spaces in wysiwyg:\r
+ // 1. White-spaces but not including NBSP;\r
+ // 2. Empty inline elements, e.g. <b></b> we're checking here\r
+ // 'offsetHeight' instead of 'offsetWidth' for properly excluding\r
+ // all sorts of empty paragraph, e.g. <br />.\r
+ invisible = !node.$.offsetHeight;\r
+ }\r
+\r
+ return !! ( isReject ^ invisible );\r
+ };\r
+ };\r
+\r
+ CKEDITOR.dom.walker.nodeType = function( type, isReject )\r
+ {\r
+ return function( node )\r
+ {\r
+ return !! ( isReject ^ ( node.type == type ) );\r
+ };\r
+ };\r
+\r
+ CKEDITOR.dom.walker.bogus = function( isReject )\r
+ {\r
+ function nonEmpty( node )\r
+ {\r
+ return !isWhitespaces( node ) && !isBookmark( node );\r
+ }\r
+\r
+ return function( node )\r
+ {\r
+ var isBogus = !CKEDITOR.env.ie ? node.is && node.is( 'br' ) :\r
+ node.getText && tailNbspRegex.test( node.getText() );\r
+\r
+ if ( isBogus )\r
+ {\r
+ var parent = node.getParent(), next = node.getNext( nonEmpty );\r
+ isBogus = parent.isBlockBoundary() &&\r
+ ( !next ||\r
+ next.type == CKEDITOR.NODE_ELEMENT &&\r
+ next.isBlockBoundary() );\r
+ }\r
+\r
+ return !! ( isReject ^ isBogus );\r