X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=_source%2Fcore%2Fdom%2Fwalker.js;h=e993f4d3c4574719e694ab5f74ff1cc3b5658f8c;hb=48b1db88210b4160dce439c6e3e32e14af8c106b;hp=1bf0eab1c65e5ec8245af210d021a7e68c3f6479;hpb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7;p=ckeditor.git
diff --git a/_source/core/dom/walker.js b/_source/core/dom/walker.js
index 1bf0eab..e993f4d 100644
--- a/_source/core/dom/walker.js
+++ b/_source/core/dom/walker.js
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
@@ -261,7 +261,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
*/
previous : function()
{
- return iterate.call( this, true );
+ return iterate.call( this, 1 );
},
/**
@@ -271,7 +271,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
*/
checkForward : function()
{
- return iterate.call( this, false, true ) !== false;
+ return iterate.call( this, 0, 1 ) !== false;
},
/**
@@ -281,7 +281,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
*/
checkBackward : function()
{
- return iterate.call( this, true, true ) !== false;
+ return iterate.call( this, 1, 1 ) !== false;
},
/**
@@ -303,7 +303,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
*/
lastBackward : function()
{
- return iterateToLast.call( this, true );
+ return iterateToLast.call( this, 1 );
},
reset : function()
@@ -334,16 +334,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
'table-column' : 1,
'table-cell' : 1,
'table-caption' : 1
- },
- blockBoundaryNodeNameMatch = { hr : 1 };
+ };
CKEDITOR.dom.element.prototype.isBlockBoundary = function( customNodeNames )
{
- var nodeNameMatches = CKEDITOR.tools.extend( {},
- blockBoundaryNodeNameMatch, customNodeNames || {} );
+ var nodeNameMatches = CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$block, customNodeNames || {} );
- return blockBoundaryDisplayMatch[ this.getComputedStyle( 'display' ) ] ||
- nodeNameMatches[ this.getName() ];
+ // Don't consider floated formatting as block boundary, fall back to dtd check in that case. (#6297)
+ return this.getComputedStyle( 'float' ) == 'none' && blockBoundaryDisplayMatch[ this.getComputedStyle( 'display' ) ]
+ || nodeNameMatches[ this.getName() ];
};
CKEDITOR.dom.walker.blockBoundary = function( customNodeNames )
@@ -374,7 +373,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
{
return ( node && node.getName
&& node.getName() == 'span'
- && node.hasAttribute('_cke_bookmark') );
+ && node.data( 'cke-bookmark' ) );
}
return function( node )
@@ -385,7 +384,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
&& isBookmarkNode( parent ) );
// Is bookmark node?
isBookmark = contentOnly ? isBookmark : isBookmark || isBookmarkNode( node );
- return isReject ^ isBookmark;
+ return !! ( isReject ^ isBookmark );
};
};
@@ -399,7 +398,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
{
var isWhitespace = node && ( node.type == CKEDITOR.NODE_TEXT )
&& !CKEDITOR.tools.trim( node.getText() );
- return isReject ^ isWhitespace;
+ return !! ( isReject ^ isWhitespace );
};
};
@@ -418,22 +417,38 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
// '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;
+ return !! ( isReject ^ isInvisible );
+ };
+ };
+
+ CKEDITOR.dom.walker.nodeType = function( type, isReject )
+ {
+ return function( node )
+ {
+ return !! ( isReject ^ ( node.type == type ) );
};
};
var tailNbspRegex = /^[\t\r\n ]*(?: |\xa0)$/,
- isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ),
- isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true ),
- fillerEvaluator = function( element )
+ isWhitespaces = CKEDITOR.dom.walker.whitespaces(),
+ isBookmark = CKEDITOR.dom.walker.bookmark(),
+ toSkip = function( node )
{
- return isNotBookmark( element ) && isNotWhitespaces( element );
+ return isBookmark( node )
+ || isWhitespaces( node )
+ || node.type == CKEDITOR.NODE_ELEMENT
+ && node.getName() in CKEDITOR.dtd.$inline
+ && !( node.getName() in CKEDITOR.dtd.$empty );
};
// Check if there's a filler node at the end of an element, and return it.
- CKEDITOR.dom.element.prototype.getBogus = function ()
+ CKEDITOR.dom.element.prototype.getBogus = function()
{
- var tail = this.getLast( fillerEvaluator );
+ // Bogus are not always at the end, e.g.