Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
ckeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vanilla ckeditor-3.5.3
[ckeditor.git]
/
_source
/
core
/
dom
/
walker.js
diff --git
a/_source/core/dom/walker.js
b/_source/core/dom/walker.js
index
04ff21e
..
e993f4d
100644
(file)
--- a/
_source/core/dom/walker.js
+++ b/
_source/core/dom/walker.js
@@
-1,5
+1,5
@@
/*
\r
/*
\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
\r
For licensing, see LICENSE.html or http://ckeditor.com/license
\r
*/
\r
\r
For licensing, see LICENSE.html or http://ckeditor.com/license
\r
*/
\r
\r
@@
-101,7
+101,7
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
node = null;
\r
}
\r
else
\r
node = null;
\r
}
\r
else
\r
- node = ( guard ( node ) === false ) ?
\r
+ node = ( guard ( node, true ) === false ) ?
\r
null : node.getPreviousSourceNode( true, type, guard );
\r
}
\r
else
\r
null : node.getPreviousSourceNode( true, type, guard );
\r
}
\r
else
\r
@@
-115,7
+115,7
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
node = null;
\r
}
\r
else
\r
node = null;
\r
}
\r
else
\r
- node = ( guard ( range.startContainer ) === false ) ?
\r
+ node = ( guard ( range.startContainer, true ) === false ) ?
\r
null : range.startContainer.getNextSourceNode( true, type, guard ) ;
\r
}
\r
}
\r
null : range.startContainer.getNextSourceNode( true, type, guard ) ;
\r
}
\r
}
\r
@@
-261,7
+261,7
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
\r
previous : function()
\r
{
\r
*/
\r
previous : function()
\r
{
\r
- return iterate.call( this, true );
\r
+ return iterate.call( this, 1 );
\r
},
\r
\r
/**
\r
},
\r
\r
/**
\r
@@
-271,7
+271,7
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
\r
checkForward : function()
\r
{
\r
*/
\r
checkForward : function()
\r
{
\r
- return iterate.call( this, false, true ) !== false;
\r
+ return iterate.call( this, 0, 1 ) !== false;
\r
},
\r
\r
/**
\r
},
\r
\r
/**
\r
@@
-281,7
+281,7
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
\r
checkBackward : function()
\r
{
\r
*/
\r
checkBackward : function()
\r
{
\r
- return iterate.call( this, true, true ) !== false;
\r
+ return iterate.call( this, 1, 1 ) !== false;
\r
},
\r
\r
/**
\r
},
\r
\r
/**
\r
@@
-303,7
+303,7
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
\r
lastBackward : function()
\r
{
\r
*/
\r
lastBackward : function()
\r
{
\r
- return iterateToLast.call( this, true );
\r
+ return iterateToLast.call( this, 1 );
\r
},
\r
\r
reset : function()
\r
},
\r
\r
reset : function()
\r
@@
-334,16
+334,15
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
'table-column' : 1,
\r
'table-cell' : 1,
\r
'table-caption' : 1
\r
'table-column' : 1,
\r
'table-cell' : 1,
\r
'table-caption' : 1
\r
- },
\r
- blockBoundaryNodeNameMatch = { hr : 1 };
\r
+ };
\r
\r
CKEDITOR.dom.element.prototype.isBlockBoundary = function( customNodeNames )
\r
{
\r
\r
CKEDITOR.dom.element.prototype.isBlockBoundary = function( customNodeNames )
\r
{
\r
- var nodeNameMatches = CKEDITOR.tools.extend( {},
\r
- blockBoundaryNodeNameMatch, customNodeNames || {} );
\r
+ var nodeNameMatches = CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$block, customNodeNames || {} );
\r
\r
\r
- return blockBoundaryDisplayMatch[ this.getComputedStyle( 'display' ) ] ||
\r
- nodeNameMatches[ this.getName() ];
\r
+ // Don't consider floated formatting as block boundary, fall back to dtd check in that case. (#6297)
\r
+ return this.getComputedStyle( 'float' ) == 'none' && blockBoundaryDisplayMatch[ this.getComputedStyle( 'display' ) ]
\r
+ || nodeNameMatches[ this.getName() ];
\r
};
\r
\r
CKEDITOR.dom.walker.blockBoundary = function( customNodeNames )
\r
};
\r
\r
CKEDITOR.dom.walker.blockBoundary = function( customNodeNames )
\r
@@
-359,12
+358,6
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
{
\r
return this.blockBoundary( { br : 1 } );
\r
};
\r
{
\r
return this.blockBoundary( { br : 1 } );
\r
};
\r
- /**
\r
- * Whether the node is a bookmark node's inner text node.
\r
- */
\r
- CKEDITOR.dom.walker.bookmarkContents = function( node )
\r
- {
\r
- },
\r
\r
/**
\r
* Whether the to-be-evaluated node is a bookmark node OR bookmark node
\r
\r
/**
\r
* Whether the to-be-evaluated node is a bookmark node OR bookmark node
\r
@@
-380,7
+373,7
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
{
\r
return ( node && node.getName
\r
&& node.getName() == 'span'
\r
{
\r
return ( node && node.getName
\r
&& node.getName() == 'span'
\r
- && node.hasAttribute('_fck_bookmark') );
\r
+ && node.data( 'cke-bookmark' ) );
\r
}
\r
\r
return function( node )
\r
}
\r
\r
return function( node )
\r
@@
-391,7
+384,7
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
&& isBookmarkNode( parent ) );
\r
// Is bookmark node?
\r
isBookmark = contentOnly ? isBookmark : isBookmark || isBookmarkNode( node );
\r
&& isBookmarkNode( parent ) );
\r
// Is bookmark node?
\r
isBookmark = contentOnly ? isBookmark : isBookmark || isBookmarkNode( node );
\r
- return isReject ^ isBookmark;
\r
+ return !! ( isReject ^ isBookmark );
\r
};
\r
};
\r
\r
};
\r
};
\r
\r
@@
-405,7
+398,7
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
{
\r
var isWhitespace = node && ( node.type == CKEDITOR.NODE_TEXT )
\r
&& !CKEDITOR.tools.trim( node.getText() );
\r
{
\r
var isWhitespace = node && ( node.type == CKEDITOR.NODE_TEXT )
\r
&& !CKEDITOR.tools.trim( node.getText() );
\r
- return isReject ^ isWhitespace;
\r
+ return !! ( isReject ^ isWhitespace );
\r
};
\r
};
\r
\r
};
\r
};
\r
\r
@@
-424,22
+417,38
@@
For licensing, see LICENSE.html or http://ckeditor.com/license
// '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
// '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
+ return !! ( isReject ^ isInvisible );
\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
var tailNbspRegex = /^[\t\r\n ]*(?: |\xa0)$/,
\r
};
\r
};
\r
\r
var tailNbspRegex = /^[\t\r\n ]*(?: |\xa0)$/,
\r
- isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ),
\r
- isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true ),
\r
- fillerEvaluator = function( element )
\r
+ isWhitespaces = CKEDITOR.dom.walker.whitespaces(),
\r
+ isBookmark = CKEDITOR.dom.walker.bookmark(),
\r
+ toSkip = function( node )
\r
{
\r
{
\r
- return isNotBookmark( element ) && isNotWhitespaces( element );
\r
+ return isBookmark( node )
\r
+ || isWhitespaces( node )
\r
+ || node.type == CKEDITOR.NODE_ELEMENT
\r
+ && node.getName() in CKEDITOR.dtd.$inline
\r
+ && !( node.getName() in CKEDITOR.dtd.$empty );
\r
};
\r
\r
// Check if there's a filler node at the end of an element, and return it.
\r
};
\r
\r
// Check if there's a filler node at the end of an element, and return it.
\r
- CKEDITOR.dom.element.prototype.getBogus = function ()
\r
+ CKEDITOR.dom.element.prototype.getBogus = function()
\r
{
\r
{
\r
- var tail = this.getLast( fillerEvaluator );
\r
+ // Bogus are not always at the end, e.g. <p><a>text<br /></a></p> (#7070).
\r
+ var tail = this;
\r
+ do { tail = tail.getPreviousSourceNode(); }
\r
+ while ( toSkip( tail ) )
\r
+
\r
if ( tail && ( !CKEDITOR.env.ie ? tail.is && tail.is( 'br' )
\r
: tail.getText && tailNbspRegex.test( tail.getText() ) ) )
\r
{
\r
if ( tail && ( !CKEDITOR.env.ie ? tail.is && tail.is( 'br' )
\r
: tail.getText && tailNbspRegex.test( tail.getText() ) ) )
\r
{
\r