Opened 16 years ago

Closed 16 years ago

#1093 closed defect (duplicate)

Javascript error when image in Editor2 widget is repeatedly clicked for IE

Reported by: guest Owned by: anonymous
Priority: high Milestone:
Component: Widgets Version: 0.3
Keywords: Cc:
Blocked By: Blocking:


When one quickly and repeatedly clicks on an image in the rich text editor (the Editor2 widget), one gets a javascript error from IE. The error occurs in the following line in Editor2.updateToolbar:

    var selectedNode = ( ? this.document.selection.createRange().parentElement() :

The above line fails because the range returned by createRange() does not have a parentElement method. This is because when an image is selected, the returned range is a ControlRange? object instead of a TextRange? object.

I was able to fix this in my own code by changing the above line to:

      var selectedNode = null;
      if ( {
        if (this.document.selection.type != "Control") {
          selectedNode = this.document.selection.createRange().parentElement();
      } else {
        selectedNode = this.window.getSelection().anchorNode;

This bug occurs in version 3.1 of the Dojo toolkit. It only occurs for IE. You can easily reproduce this on the Jotspot wiki by selecting an image in your editor pane, then repeatedly and quickly clicking on it until you get a javascript error. It usually fails after about six clicks or so. It will not fail if you click slowly on it.

Change History (1)

comment:1 Changed 16 years ago by [email protected]

Resolution: duplicate
Status: newclosed

Accidentally created two copies of the same ticket. Marking as a duplicate of bug 1094.

Note: See TracTickets for help on using tickets.