X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fcore%2Fdom%2Fwalker.js;h=04ff21ec4d73b9a2e5deeba6cb9eff7f03b806f6;hp=d7934b8113ee305fe65420eb22cc8ba3c2741572;hb=941b0a9ba4e673e292510d80a5a86806994b8ea6;hpb=7cd80714081a8ffdf4a1a8d2c72f120ed5ef3d6d diff --git a/_source/core/dom/walker.js b/_source/core/dom/walker.js index d7934b8..04ff21e 100644 --- a/_source/core/dom/walker.js +++ b/_source/core/dom/walker.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -428,4 +428,24 @@ For licensing, see LICENSE.html or http://ckeditor.com/license }; }; + var tailNbspRegex = /^[\t\r\n ]*(?: |\xa0)$/, + isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ), + isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true ), + fillerEvaluator = function( element ) + { + return isNotBookmark( element ) && isNotWhitespaces( element ); + }; + + // Check if there's a filler node at the end of an element, and return it. + CKEDITOR.dom.element.prototype.getBogus = function () + { + var tail = this.getLast( fillerEvaluator ); + if ( tail && ( !CKEDITOR.env.ie ? tail.is && tail.is( 'br' ) + : tail.getText && tailNbspRegex.test( tail.getText() ) ) ) + { + return tail; + } + return false; + }; + })();