#3469: Simplify range walking codes
-----------------------+----------------------------------------------------
Reporter: garry.yao | Owner: garry.yao
Type: Bug | Status: assigned
Priority: High | Milestone: CKEditor 3.0
Component: General | Version:
Keywords: Confirmed |
-----------------------+----------------------------------------------------
Changes (by garry.yao):
* keywords: => Confirmed
Old description:
> The new range walker API is about to be ready with #3367, it introduced a
> completely new simplified way to perform daily range work, it's concise
> and powerful to support the the following ways when walk along
> range.[[BR]]
> We should try to replace the bells and whistles we've had in v2 for
> ranges manipulation with this new API after we close #3367.
>
> Now we could:
> 1. Walking along the content inside the range, mostly useful for style
> system.
> {{{
> outside [->...inside...<-]outside
> }}}
> With
> {{{
> #!js
> var walker = new CKEDITOR.dom.walker( range ), node;
> while ( node = walker.next() )
> {
> // Node processing...
> }
> }}}
> 1. Walking along the other opposite two sides of the range, mostly
> useful for enlargement and checking block boundary.
> {{{
> outside <-[ ...inside...]-> outside
> }}}
> With
> {{{
> #!js
> // E.g. Walking along the left out side
> var walkerRange = new CKEDITOR.dom.range();
> walkerRange.setStartAt( document.getBody(), CKEDITOR.POSITION_AFTER_START
> );
> walkerRange.setEndAt( range.startContainer, range.startOffset );
> walker.guard = function()
> {
> //// Node processing...
> };
> do
> {
> node = walker.next()
> }
> while ( node )
>
> }}}
> 1. Retrieve the boundary nodes of collapsed range:
> {{{
> leftBoundaryNode<-^->rightBoundaryNode
> }}}
> With
> {{{
> #!js
> // E.g. Get the end boundary node after the range.
> var walkerRange = new CKEDITOR.dom.range();
> walkerRange.setStartAt( range.endContainer, range.endOffset );
> walkerRange.setEndAt( document.getBody(), CKEDITOR.POSITION_BEFORE_END );
> var endBoundaryNode = walkerRange.next();
> }}}
> 1. Even other usages could be expanded...
New description:
The new range walker API is about to be ready with #3367, it introduced a
completely new simplified way to perform daily range work, it's concise
and powerful to support the the following ways when walk along
range.[[BR]]
We should try to replace the bells and whistles we've had in v2 for ranges
manipulation with this new API after we close #3367.
Now we could:
1. Walking along the content inside the range, mostly useful for style
system.
{{{
outside [->...inside...<-]outside
}}}
With
{{{
#!js
var walker = new CKEDITOR.dom.walker( range ), node;
while ( node = walker.next() )
{
// Node processing...
}
}}}
1. Walking along the other opposite two sides of the range, mostly useful
for enlargement and checking block boundary.
{{{
outside <-[ ...inside...]-> outside
}}}
With
{{{
#!js
// E.g. Walking along the left out side
var walkerRange = new CKEDITOR.dom.range();
walkerRange.setStartAt( document.getBody(), CKEDITOR.POSITION_AFTER_START
);
walkerRange.setEndAt( range.startContainer, range.startOffset );
walker.guard = function()
{
//// Node processing...
};
do
{
node = walker.next()
}
while ( node )
}}}
1. Retrieve the boundary nodes of collapsed range:
{{{
leftBoundaryNode<-^->rightBoundaryNode
}}}
With
{{{
#!js
// E.g. Get the end boundary node after the range.
var walkerRange = new CKEDITOR.dom.range();
walkerRange.setStartAt( range.endContainer, range.endOffset );
walkerRange.setEndAt( document.getBody(), CKEDITOR.POSITION_BEFORE_END );
var endBoundaryNode = walkerRange.next();
}}}
1. Even other usages could be expanded...
=== Sub Tickets ===
[[TicketQuery(id=3478)]]
--
--
Ticket URL: <http://dev.fckeditor.net/ticket/3469#comment:2>
FCKeditor <http://www.fckeditor.net/>
The text editor for Internet
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac