Opened 15 years ago

Closed 15 years ago

#3436 closed Bug (fixed)

Inline styles are being applied to outside of selected area in IE.

Reported by: Martin Kou Owned by: Martin Kou
Priority: Normal Milestone: CKEditor 3.0
Component: Core : Styles Version: SVN (CKEditor) - OLD
Keywords: IE8 Confirmed Review+ Cc:

Description

To reproduce:

  1. Open replacebyclass.html in IE.
  2. Double click "You" in the editing area.
  3. Click the Bold button.
  4. "You are using " is bolded.

The bug can be reproduced across IE6, 7 and 8.

Attachments (2)

3436_tc.patch (2.2 KB) - added by Martin Kou 15 years ago.
3436.patch (3.0 KB) - added by Martin Kou 15 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 15 years ago by Garry Yao

Keywords: WorksForMe added

WFM, can you re-verify it?

comment:2 Changed 15 years ago by Martin Kou

Owner: set to Martin Kou
Status: newassigned

comment:3 Changed 15 years ago by Martin Kou

Keywords: WorksForMe removed

I can still reproduce it in IE8, in both compatibility mode and standards mode.

Screencast here: http://screencast.com/t/pujottPWZ

comment:4 Changed 15 years ago by Martin Kou

Keywords: IE8 added; IE removed

After some rechecking, the problem is specific to IE8. And the culprit seems to be the selection plugin. Still investigating for the fix.

Changed 15 years ago by Martin Kou

Attachment: 3436_tc.patch added

comment:5 Changed 15 years ago by Martin Kou

Added unit test case, it passes in IE6 and IE7, but fails in IE8. The bug is definitely in the selection plugin.

comment:6 Changed 15 years ago by Garry Yao

Keywords: Confirmed added

A while ago when I tested on IE8 FC, it's shown that the native selection range reporting is incorrect, not sure but probably browser bug somehow.

comment:7 Changed 15 years ago by Martin Kou

Ok, this is a really hideous browser DOM bug. The problem (as in the test case) happens like this:

  1. A DOM range object is obtained in L31 of the test case, and the range's positions are actually correct.
  2. range.select() is called.
  3. range.select() inserts bookmark nodes into the document. The bookmark at the end point is inserted first. This end point is right after the string "This".
  4. range.createBookmark() is called.
  5. range.createBookmark() calls trim() to split "This" from " is some " on a cloned range object whose position is collapsed right after "This".
  6. So cloned.trim() calls textNode.split(4). So the text node "This is some " is split into "This" and " is some ". So far so good.
  7. So cloned.trim() updates the startParent to the parent P node and startOffset to 1. Which means the collapsed range's position is now theoretically at "This^ is some".
  8. But no... IE8 thinks the range's position is actually at "This is some^<strong>sample text</strong>" despite we've got the correct startContainer and the correct startOffset! See next point for the reason.
  9. Apparently IE8 thinks P.childNodes[0] is "This" - that's correct. But P.childNodes[1] is the STRONG tag! Despite the fact that it will report correctly to you that STRONG.previousSibling is " is some " and "This".nextSibling is " is some ".

Alfonso has already reported this bug to Microsoft here: http://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=426520.

Changed 15 years ago by Martin Kou

Attachment: 3436.patch added

comment:8 Changed 15 years ago by Martin Kou

Keywords: Review? added

comment:9 Changed 15 years ago by Garry Yao

Keywords: Review+ added; Review? removed

comment:10 Changed 15 years ago by Martin Kou

Resolution: fixed
Status: assignedclosed

Fixed with [3470].

Click here for more info about our SVN system.

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