﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
13089	Mismatch in logic between getByAddress and getIndex regarding empty text nodes	mweathers		"The symptom I am experiencing is during an Undo, the bookmarks that are being created are not matching up when getByAddress tries to look them up later. I have tracked this down to the fact that ""getIndex"" inside core/dom/node.js skips blank nodes:

			// Bypass blank node and adjacent text nodes.
			if ( normalized && current != this.$ && current.nodeType == CKEDITOR.NODE_TEXT && ( isNormalizing || !current.nodeValue ) )
				continue;

However, getByAddress in document.js does not skip blank text nodes. It seems to compress multiple text nodes into one, but does not skip blank nodes. This means that if I have a blank node above my editor, the undo action is constantly encountering warnings about ""<node> is not a descendent of root"" that eventually can result in my users losing large amounts of text when they undo. Here is the stack trace of the error that eventually occurs and causes a big problem:

IndexSizeError: Failed to execute 'setEnd' on 'Range': The offset 19 is larger than or equal to the node's length (0).
 at Error in native:0
 at Object.CKEDITOR.dom.selection.selectRanges in http://localhost:5000/ckeditor/core/selection.js:1926:19
 at Object.CKEDITOR.dom.selection.selectBookmarks in http://localhost:5000/ckeditor/core/selection.js:2069:10
 at Object.UndoManager.restoreImage in http://localhost:5000/ckeditor/plugins/undo/plugin.js:423:9
 at Object.UndoManager.undo in http://localhost:5000/ckeditor/plugins/undo/plugin.js:508:18
 at Object.CKEDITOR.plugins.add.init.editor.addCommand.exec in http://localhost:5000/ckeditor/plugins/undo/plugin.js:29:23
 at Object.exec in http://localhost:5000/ckeditor/core/command.js:52:35
 at CKEDITOR.tools.extend.execCommand in http://localhost:5000/ckeditor/core/editor.js:829:38
 at Object.onKeyDown in http://localhost:5000/ckeditor/core/keystrokehandler.js:56:24
 at listenerFirer in http://localhost:5000/ckeditor/core/event.js:144:33

My application is an Ember app, so ideally the fix would be to resolve https://dev.ckeditor.com/ticket/10411 as it is quite common to have elements appearing/disappearing around the editor in such an application, which would completely mess up the bookmarks. But in the mean time, it would be great to have this particular issue fixed, as I can't remove the empty text node that is causing the problem."	Bug	closed	Normal		Core : Undo & Redo	4.4.7	duplicate		
