Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#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 bill)

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)

example_IE9inIE8compatibleMode_has(ie)_error.html (876 bytes) - added by towby 7 years ago.
example_docmode.html (1.2 KB) - added by Bryan Forbes 7 years ago.
meta.patch (1.0 KB) - added by bill 7 years ago.
patch to copy meta tag from main document to <iframe>; unfortunately throws an error on IE about the document mode already being defined

Download all attachments as: .zip

Change History (18)

comment:1 Changed 7 years ago by 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.

comment:2 in reply to:  1 Changed 7 years ago by towby

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 7 years ago by Bryan Forbes

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 7 years ago by Bryan Forbes

Attachment: example_docmode.html added

comment:4 Changed 7 years ago by bill

Component: GeneralEditor
Description: modified (diff)
Summary: has('ie') fails for IE9 in IE8 compatible modeexceptions 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 7 years ago by towby

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 7 years ago by bill

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 7 years ago by bill

Milestone: tbd1.8
Owner: set to bill
Status: newassigned

Changed 7 years ago by bill

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 7 years ago by towby

ok, can't use it if it throws another error. I'll wait for the final bugfix.

comment:9 Changed 7 years ago by bill

Resolution: fixed
Status: assignedclosed

In [28090]:

Avoid browser sniffing and has() flag precomputation in selection.js. This is to fix a corner case in IE9 where the main document is in IE8 compatibility mode, but the editor iframe is in IE9 standards mode. In this case the iframe should act like IE9, but it actually acts more like IE8.

Also rearranging if/else blocks to put W3C code path first.

Fixes #14900 !strict.

comment:10 Changed 7 years ago by towby

works fine.. thanks!

comment:11 Changed 6 years ago by bill

In [30259]:

Minimal backport of changes in [28090] to 1.7 branch, to use feature detection rather than browser sniffing, fixes #14900 on 1.7 branch !strict.

comment:12 Changed 6 years ago by bill

Milestone: 1.81.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 6 years ago by bill

Summary: exceptions on newline in EnterKeyHandling plugin when document in IE8 compat modeexceptions about getSelection when document in IE8 compat mode

comment:14 Changed 4 years ago by Bill Keese <bill@…>

In 5377c6c63e6ae5aaaac9a3cdd5833cbc80a09546/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:15 Changed 4 years ago by Bill Keese <bill@…>

In 598905daf76bf419302a37eb8d9a596c8c58312b/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 
Note: See TracTickets for help on using tickets.