Opened 15 years ago

Closed 11 years ago

#3469 closed Bug (wontfix)

Simplify range walking codes

Reported by: Garry Yao Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description (last modified by Garry Yao)

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.
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
    var walker = new CKEDITOR.dom.walker( range ), node;
    while ( node = walker.next() )
    {
            // Node processing...
    }
    
  2. Walking along the other opposite two sides of the range, mostly useful for enlargement and checking block boundary.
    outside <-[ ...inside...]-> outside 
    
    With
    // 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 )
    
    
  3. Retrieve the boundary nodes of collapsed range:
    leftBoundaryNode<-^->rightBoundaryNode
    
    With
    // 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();
    
  4. Even other usages could be expanded...

Sub Tickets

#3478
Simplify styles processing

Change History (9)

comment:1 Changed 15 years ago by Garry Yao

Owner: set to Garry Yao
Status: newassigned

Since there's many parts involved, I'll open sub tickets for every single part for it, this one become an umbrella ticket.

comment:2 Changed 15 years ago by Garry Yao

Description: modified (diff)
Keywords: Confirmed added
Summary: Simply range walking codesSimplify range walking codes

comment:3 Changed 15 years ago by Garry Yao

Milestone: CKEditor 3.0CKEditor 3.1

comment:4 Changed 14 years ago by Garry Yao

Owner: Garry Yao deleted
Priority: HighNormal
Status: assignednew

comment:5 Changed 14 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.1CKEditor 3.2

comment:6 Changed 14 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.2CKEditor 3.3

comment:7 Changed 14 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.3CKEditor 3.x

comment:8 Changed 14 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.x

Milestone CKEditor 3.x deleted

comment:9 Changed 11 years ago by Piotrek Koszuliński

Resolution: wontfix
Status: confirmedclosed

Expired. It's not clear about what is that ticket, but I think that it's mostly done.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy