Opened 14 years ago
Closed 11 years ago
#6738 closed Bug (expired)
Inconsistent getCommonAncestor, need for shrink function?
Reported by: | Dinu | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | |
Keywords: | Cc: |
Description
- CKEDITOR.dom.selection.getStartElement, modifies the range; this results in that getCommonAncestor can produce different results whether it's called before or after getStartElement; it is very unusual for a getter to modify data other getters use.
- For #6735 to work properly, it might be needed to shrink the selection like #3231, but at both ends
- The following approach would satisfy all #3231 , #3950 and #6735 in an elegant way: create a function that shrinks the selection starting with the end, then, if not yet collapsed, from the start. This would eliminate the need for the "only blocks" exception, since the selection would be collapsed at the start in the shrink-end phase in the </td><td> case, rather than being collapsed at the end as it happens now.
Change History (5)
comment:1 Changed 14 years ago by
Status: | new → pending |
---|
comment:2 Changed 14 years ago by
I think range.setStartAfter( startContainer ); does modify the range, unless it's dead code or ranges caching doesn't work. I was wrong however, it shouldn't affect getCommonAncestor, but it does affect my code (checkIsReadOnly) by moving the startContainer. Consider:
<p><span contenteditable="false">foo[</span>bar]</p>
checkIsReadOnly():true
getStartElement:
<p><span contenteditable="false">foo</span>[bar]</p>
checkIsReadOnly():false
I'll try to produce some code
comment:4 Changed 14 years ago by
comment:5 Changed 11 years ago by
Resolution: | → expired |
---|---|
Status: | pending → closed |
The selection::getStartElement
method was actually modifying range (by calling shrink
). I fixed this when working on #9764.
Closing this issue as expired.
selection::getStartElement doesn't actually modify the editor selection range, could you provide an example (code) by saying it affects selection::getCommonAncestor?