Opened 15 years ago
Closed 15 years ago
#4970 closed Bug (duplicate)
IE selection produces incorrect range when clicking to the right of a <br />
Reported by: | Scott McNaught | Owned by: | |
---|---|---|---|
Priority: | Must have (possibly next milestone) | Milestone: | |
Component: | General | Version: | SVN (CKEditor) - OLD |
Keywords: | Cc: |
Description
Hello,
The following HTML, with a collapsed selection currently located at "][", will produce an incorrect range in IE. I am quite confident the problem lies in selection/getBoundaryInformation().
HTML: <p>Line 1][<br /> Line 2</p>
The range produced will show the position at: <p>Line 1<br /> ][Line 2</p>
A simple test case would be to call Range::insertNode() with a simple text node with the caret at the above position.
var pNode = new CKEDITOR.dom.node(pRange.document.$.createTextNode('a')); pRange.insertNode(pNode);
I have screencasted this issue to fredck.
Attachments (3)
Change History (7)
Changed 15 years ago by
Attachment: | click_before.png added |
---|
Changed 15 years ago by
Attachment: | click_after.png added |
---|
Changed 15 years ago by
Attachment: | mouse_down_up.png added |
---|
comment:1 Changed 15 years ago by
Priority: | Normal → High |
---|
Ok I spent an hour or so trying to figure out what was going on here, and I have found the location where its going wrong, but I dont know exactly why.
The problem is in selection/plugin.js getBoundaryInformation() at line 471. I am using Companion.JS to enable "console.log".
Here are the console.log calls I made.
var comparison = testRange.compareEndPoints( 'StartToStart', range ); console.log(child.nodeName); console.log(comparison);
Immediately it showed me why I was experiencing this randomly. The problem only happens when clicking to the right of the <p>, when the mouse cursor icon is "default arrow", not "text".
When you click just at the end of the text, when the caret is text, it works fine.
When you click to the right, epic fail.
But strangely, something must fix it with an onmouseup handler? It somehow fixes it again if you click and hold down the mouse button for a second or so. On mouse up, the comparison goes back to 0.
Because ranges are so core, this bug could be causing some seemingly random problems for people. Hope it can be fixed soon :)
comment:2 Changed 15 years ago by
Summary: | IE selection produces incorrect range when caret is immediately before a <br /> → IE selection produces incorrect range when clicked to the right of a <br /> |
---|
comment:3 Changed 15 years ago by
Summary: | IE selection produces incorrect range when clicked to the right of a <br /> → IE selection produces incorrect range when clicking to the right of a <br /> |
---|
comment:4 Changed 15 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Click when mouse cursor is text caret