Opened 14 years ago

Closed 14 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)

click_before.png (14.3 KB) - added by Scott McNaught 14 years ago.
Click when mouse cursor is text caret
click_after.png (12.0 KB) - added by Scott McNaught 14 years ago.
mouse_down_up.png (22.9 KB) - added by Scott McNaught 14 years ago.

Download all attachments as: .zip

Change History (7)

Changed 14 years ago by Scott McNaught

Attachment: click_before.png added

Click when mouse cursor is text caret

Changed 14 years ago by Scott McNaught

Attachment: click_after.png added

Changed 14 years ago by Scott McNaught

Attachment: mouse_down_up.png added

comment:1 Changed 14 years ago by Scott McNaught

Priority: NormalHigh

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. http://dev.fckeditor.net/raw-attachment/ticket/4970/click_before.png

When you click to the right, epic fail. http://dev.fckeditor.net/raw-attachment/ticket/4970/click_after.png

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. http://dev.fckeditor.net/raw-attachment/ticket/4970/mouse_down_up.png

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 14 years ago by Scott McNaught

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 14 years ago by Scott McNaught

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 14 years ago by Scott McNaught

Resolution: duplicate
Status: newclosed
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