#14900 closed defect (fixed)
exceptions about getSelection when document in IE8 compat mode
Reported by: | towby | Owned by: | bill |
---|---|---|---|
Priority: | undecided | Milestone: | 1.7.5 |
Component: | Editor | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description (last modified by )
If Internet Explorer 9 is run in IE8 document mode ( e.g. by using meta-tag <meta http-equiv="X-UA-Compatible" content="IE=8"> )
Please see attached dijit.Editor example:
- Open the page in IE9
- click into the editor
- hit enter key
=> The call to win.global.getSelection in dijit._editor.selection fails.
has('ie') in the editor code returns 9 instead of 8, since the iframe does not have the meta tag.
Attachments (3)
Change History (18)
Changed 9 years ago by
Attachment: | example_IE9inIE8compatibleMode_has(ie)_error.html added |
---|
comment:1 follow-up: 2 Changed 9 years ago by
comment:2 Changed 9 years ago by
Replying to bill:
That's strange because if I load dojo/tests/sniff.html, and set document mode in the developer tools (F12) to IE8, then has("ie") returns 8.
yep, if manually changing the IE document mode from 9 to 8 everything looks and works fine. It only occurs if the document mode is switched via the compatible meta tag. But no one changes the document mode manually (except developers) ;)
comment:3 Changed 9 years ago by
The problem is that the document mode of the iframe is not the same as the parent document and has() is being used in dijit/_editor/selection.js to determine which API to use and is wrong for the iframe context (parent page is IE8 standards, iframe is IE9 quirks). I'm attaching a test case showing what's going on.
Changed 9 years ago by
Attachment: | example_docmode.html added |
---|
comment:4 Changed 9 years ago by
Component: | General → Editor |
---|---|
Description: | modified (diff) |
Summary: | has('ie') fails for IE9 in IE8 compatible mode → exceptions on newline in EnterKeyHandling plugin when document in IE8 compat mode |
Updating summary, description, and component, because as Bryan implied, this issue is specific to the Editor.
has("ie") on the main page returns 8, as it should, and has("ie") when working with the editor iframe returns 9, as it should, since the editor's iframe does not have the <meta> tag.
The win.global.getSelection() call, where win.global is the iframe, should be working. But the problem appears to be (and I've seen this before somewhere) that the back-compat setting in the main document seeps into the iframe, so there is no iframe.getSelection() method even though the iframe is in IE9 mode.
Probably the simplest solution (as suggested on the mailing list is to make the iframe have the same <meta> tag as the main document.
comment:5 Changed 9 years ago by
Yep, that sounds like the easiest way. Is there any supported way to set this meta tag for the rich text iframe atm??
I just had a brief look in the dijit/_editor/RichText.js source but the function _getIframeDocTxt() looks like there is no chance to change something like that via setter functions or properties.
comment:6 Changed 9 years ago by
Turns out the <meta> thing doesn't work; IE gives an error message. I'll attach the patch for reference though. So instead I'll just change selection.js to do feature detection.
comment:7 Changed 9 years ago by
Milestone: | tbd → 1.8 |
---|---|
Owner: | set to bill |
Status: | new → assigned |
Changed 9 years ago by
Attachment: | meta.patch added |
---|
patch to copy meta tag from main document to <iframe>; unfortunately throws an error on IE about the document mode already being defined
comment:8 Changed 9 years ago by
ok, can't use it if it throws another error. I'll wait for the final bugfix.
comment:12 Changed 8 years ago by
Milestone: | 1.8 → 1.7.5 |
---|
Note that this is also the cause of the "insert link" dialog not closing after pressing set. Again, only when using the <meta http-equiv="X-UA-Compatible" content="IE=8"> tag and running on IE9 or IE10.
comment:13 Changed 8 years ago by
Summary: | exceptions on newline in EnterKeyHandling plugin when document in IE8 compat mode → exceptions about getSelection when document in IE8 compat mode |
---|
That's strange because if I load dojo/tests/sniff.html, and set document mode in the developer tools (F12) to IE8, then has("ie") returns 8.