Opened 6 years ago

Closed 6 years ago

#17362 closed defect (worksforme)

[PATCH][CLA]Dijit/Selection IE way throws sometimes errors

Reported by: Millennium Owned by: Millennium
Priority: undecided Milestone: tbd
Component: Dijit Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:

Description

In the IE way code, when the code false back to the final Else, somtimes "rg.moveToBookmark(mark);" fails. And calling "rg.select()" throws an error than.

}else if(doc.selection && mark){
          //'IE' way.
          var rg;
          if(mark.pRange){
            rg = mark.range;
          }else if(lang.isArray(mark)){
            rg = doc.body.createControlRange();
            //rg.addElement does not have call/apply method, so can not call it directly
            //rg is not available in "range.addElement(item)", so can't use that either
            array.forEach(mark, function(n){
              rg.addElement(n);
            });
          }else{
            rg = doc.body.createTextRange();
            rg.moveToBookmark(mark);
          }
          rg.select();
        }

I patched it the following way:

}else if(doc.selection && mark){
          //'IE' way.
          var rg, doSelect = true;
          if(mark.pRange){
            rg = mark.range;
          }else if(lang.isArray(mark)){
            rg = doc.body.createControlRange();
            //rg.addElement does not have call/apply method, so can not call it directly
            //rg is not available in "range.addElement(item)", so can't use that either
            array.forEach(mark, function(n){
              rg.addElement(n);
            });
          }else{
            rg = doc.body.createTextRange();
            doSelect = rg.moveToBookmark(mark);
          }
          if (doSelect) rg.select();
        }

Change History (3)

comment:1 Changed 6 years ago by bill

Owner: set to Millennium
Status: newpending

Please attach a test case using the "attach file" button. It should be as small as possible to still reproduce the problem, almost always a single HTML file that we can load in the browser (i.e. not PHP, JSP, etc.).

Then, give exact instructions on how to reproduce the problem using your attached test file, including the browser and version to use.

The test case is necessary both to confirm that there's a bug, and for us to be able to debug the problem.

Alternately, you can give instructions on how to reproduce the problem with an existing test case (in the tests/ directory).

Thanks!

comment:2 Changed 6 years ago by Millennium

Status: pendingnew

Well the browser is easy should be IE, cause it's the IE codepath affected.

It's hard to isolate the case itself, from our project. But it has something to do, with the dijit's refocus code and Dialogs. Some how the bookmark is placed on a node, which is after opening/closing the dialogs not avialable.

Like I said it's some IE problem. Doesn't always happen. Possible something to do with async xhr calls. But it happens occasionly. Traced it back months ago, to the bookmark code.

Forgot to make a bug/patch report then.

comment:3 Changed 6 years ago by bill

Resolution: worksforme
Status: newclosed

OK. Well, thanks for the patch, but it's dojo's policy to fail early, rather than masking errors. So I don't want to just check in your change, because the real issue is why moveToBookmark() is failing in the first place... perhaps it's being done on a hidden node?

If you come up with a test case let me know and I'll take a look. I know it's hard for intermittent problems.

Note that this code should really only be running for Editor.

Note: See TracTickets for help on using tickets.