Opened 6 years ago

Last modified 6 years ago

#10261 confirmed Bug

Walker documentation seems to be outdated

Reported by: Piotrek Koszuliński Owned by:
Priority: Normal Milestone:
Component: Documentation & Samples Version:
Keywords: Cc:

Description (last modified by Piotrek Koszuliński)

http://docs.ckeditor.com/#!/api/CKEDITOR.dom.walker

It says that walker may split nodes and the examples shows such a case. However, neither unit tests nor my manual tests proved that.

Source: http://stackoverflow.com/questions/15613082/ckeditor-walker-get-selection-only

Change History (2)

comment:1 Changed 6 years ago by Piotrek Koszuliński

Description: modified (diff)

comment:2 Changed 6 years ago by Jakub Ś

Status: newconfirmed

Docs may be in fact wrong:

With the following code in editor {{{<p>Some <strong>sample text</strong> and some</p> }}} and with the following code on HTML page:

var editor = CKEDITOR.replace( 'editor1', {} );	
var doc = editor.document;
function a(doc, editor){				
	walker = new CKEDITOR.dom.walker( editor.getSelection().getRanges()[ 0 ] );
		walker.evaluator = function( node ) {				   
		  console.log( node );
				   
	};
	while ( ( node = walker.previous() ) );//.next();
}
...
<input type="button" value="Click" onclick="a(doc,editor);" />		

and with following selection 'Some sample' text and some

The forward walk returns "Some" text node, strong node and "sample text" text node while the backward walk returns "sample text" and "Some" text nodes.

There is no block element in this.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy