Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361586

Summary: A few tweaks required to use TextView on IE7 - apparent mismatch between variables
Product: [ECD] Orion Reporter: Christophe Cornu <christophe.cornu+eclipse>
Component: EditorAssignee: Felipe Heidrich <eclipse.felipe>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: eclipse.felipe, Silenio_Quarti, simon_kaegi
Version: 0.2   
Target Milestone: 0.4 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
textview.js with a few tweaks to show up on IE7 none

Description Christophe Cornu CLA 2011-10-20 15:22:01 EDT
Build Identifier: Orion 0.2

This is related to https://jazz.net/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/173748

In RTC, we are supposed to drop IE7 support at some point in the current release, but this isn't the case at this time. I found a couple of minor tweaks needed in textview.js to have your example minimaleditor.html show up on IE7. Feel free to WONTFIX on the assumption that in the next few months no one would care about IE7 anymore... So this is more like for your information. Thank you!

1. IE 7 detection

The following line doesn't detect IE7 - document.documentMode is undefined. This causes the javascript to break up a few lines later.

var isIE = document.selection && window.ActiveXObject && /MSIE/.test(navigator.userAgent) ? document.documentMode : undefined;

I replaced the line above with something that's good enough for us but can be done better..

	var isIE = undefined;
	if (document.selection && window.ActiveXObject && /MSIE/.test(navigator.userAgent)) {
		/**
		 * Orion & IE7 bug. documentMode doesn't exist before IE8. We need to work on IE7. Workaround
		 * is to assume IE7 when this property is missing.
		 */
		isIE = document.documentMode ? document.documentMode : 7;
	}

2. Apparent mismatch between local parentDocument and global document variables in _updateRuler method

For some reason, IE7 seems to be sensitive to adding nodes created with the wrong document variable. It throws an exception and the editor doesn't come up. The VS debugger says things like "htmlfile: Invalid argument error using AppendChild".

I simply had to replace the 3 occurrences of the line below in _updateRuler

frag = document.createDocumentFragment();

with

frag = parentDocument.createDocumentFragment();

There may be a few more little pbs elsewhere, but that was enough to get my use cases working.

Reproducible: Always
Comment 1 Christophe Cornu CLA 2011-10-20 15:23:25 EDT
Created attachment 205673 [details]
textview.js with a few tweaks to show up on IE7
Comment 2 Christophe Cornu CLA 2011-10-20 15:45:46 EDT
How to reproduce:
Open example minimaleditor.html from orion 0.2 in IE7
It doesn't show up
Comment 3 Felipe Heidrich CLA 2011-10-24 13:22:10 EDT
(In reply to comment #0)
> Build Identifier: Orion 0.2
> 1. IE 7 detection

We need to fix this, to assume IE 7 when document.documentMode is undefined is not correct (it would be IE 6, IE 5, etc).

But I guess we don't care for anything before IE 7 ?


> 2. Apparent mismatch between local parentDocument and global document variables

We fixed that some time ago, orion 0.3 includes this fix.