#10798 closed defect (fixed)
dijit._editor.RichText focus() bug
Reported by: | Phil DeJarnett | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.5 |
Component: | Editor | Version: | 1.4.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
If one calls dijit.Editor.focus() on a non-IE before the editor gets properly initialized, dijit.Editor throws an error stating that this.editNode is NULL (not an object).
The error is due to this line in dijit/_editor/RichText.js:
927 focus: function(){ 928 // summary: 929 // Move focus to this editor 930 if(!dojo.isIE){ 931 dijit.focus(this.iframe); 932 if(this._cursorToStart){ 933 delete this._cursorToStart; 934 if(this.editNode.childNodes && -----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^
Simply changing this line to include a check against this.editNode would fix the bug.
Alternatively, since the check is needed on both browsers, the contents for the entire function could be wrapped in
if(this.editNode) { // contents }
And the check could be removed from the IE half.
(Note this error occurs under 1.4.1, but there isn't a bug reporting option for 1.4.1.)
Change History (3)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
This is fixed in an alternative way in 1.5
if(!this.isLoaded){
this.focusOnLoad = true; return;
}
...
Closing
comment:3 Changed 11 years ago by
Milestone: | tbd → 1.5 |
---|
You shouldn't call focus befor editor initialization has completed. You can avoid such by:
editor.onLoadDeferred.addCallback(function(){
});