Opened 6 years ago

Closed 5 years ago

#1418 closed defect (fixed)

Crash in IE8 when adding an image if there is no selection

Reported by: guest Owned by: gogo
Priority: normal Milestone: 0.96
Component: Xinha Core Version: trunk
Severity: major Keywords: IE8, crash
Cc:

Description

To reproduce the bug, just try inserting an image when there is no current text selection.

Another clue to the problem can be seen when running demo of the latest build on IE8:
http://www.xinha.org/xinha-nightly/examples/ExtendedDemo.html

Simply clicking in the Xinha editor causes an "unspecified exception" at line 752 of InternetExplorer?.js where the call to sel.createRange() fails because sel.type == "None".

-- fas

  1. Andy Seidl

MyST Technology Partners, Inc.

Attachments (1)

Xinha IE8 Image bug.png (23.0 KB) - added by guest 5 years ago.

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by guest

comment:1 follow-up: Changed 5 years ago by guest

I get this error whenever inserting an image in IE8 when there's no text selected.

I've tried 0.96beta, 0.96beta2, and the most recent nightly.

I've deleted my cache several times, but I seem to continue receiving errors for code that (as far as I can tell) doesn't appear to still be around. I'm a bit perplexed, but perhaps it's just my unfamiliarity with xinha and IE8.

comment:2 in reply to: ↑ 1 Changed 5 years ago by guest

Replying to guest:

I get this error whenever inserting an image in IE8 when there's no text selected.

I've tried 0.96beta, 0.96beta2, and the most recent nightly.

I've deleted my cache several times, but I seem to continue receiving errors for code that (as far as I can tell) doesn't appear to still be around. I'm a bit perplexed, but perhaps it's just my unfamiliarity with xinha and IE8.

I've investigated this further today and it does seem to be a caching issue on my behalf.

It's very strange. IE tells me it clears the cache and has deleted the temp files ,but then insists on loading an old vertsion. I tested this by sticking an alert in there. It loaded the first time today and displayed the alert. I commented it out and saved and deleted my cache. I'm still getting the alert.

Why is IE such a pain?

comment:3 Changed 5 years ago by guest

  • Severity changed from blocker to major

The same error occures when editing an image in IE8. The problem lies in the fact that IE knows two kinds of ranges. TextRanges? and ControlRanges?. When selecting an image and editing it, the code tries to check if the range has been moved by checking if the parentElement has changed. But ControlRanges? don't have a parentElement. I changed the code at rows 473 and below in InternetExplorer?.js ( modules/internetexplorer/ ) from :

if ( findDoc(savedSelection.parentElement()) == findDoc(range.parentElement()))

{

if (range.isEqual(savedSelection))
{

The selection hasn't moved, no need to restore.
return;

}

}

try { savedSelection.select() } catch (e) {};
range = this.createRange(this.getSelection());
if ( range.parentElement() != savedSelection.parentElement())


to

if ( ( savedSelection.parentElement != undefined ) && findDoc(savedSelection.parentElement()) == findDoc(range.parentElement()))

{

if (range.isEqual(savedSelection))
{

The selection hasn't moved, no need to restore.
return;

}

}

try { savedSelection.select() } catch (e) {};
range = this.createRange(this.getSelection());
if (( savedSelection.parentElement != undefined ) && range.parentElement() != savedSelection.parentElement())


which solves the problem.

With regards.

comment:4 Changed 5 years ago by gogo

  • Resolution set to fixed
  • Status changed from new to closed

This was fixed in a previous changeset.

Note: See TracTickets for help on using tickets.