Opened 7 years ago

Closed 7 years ago

#14285 closed defect (duplicate)

getComputedStyle causing editor load issues for some IE9 users?

Reported by: dylan Owned by: Kenneth G. Franqueiro
Priority: high Milestone: tbd
Component: HTML Version: 1.6.1
Keywords: getcomputedstyle, IE9, editor Cc:
Blocked By: Blocking:

Description

In 1.6.1, in _base/html.js we have the following:

		}else if(d.isIE){
		gcs = function(node){
			// IE (as of 7) doesn't expose Element like sane browsers
			return node.nodeType == 1 /* ELEMENT_NODE*/ ? node.currentStyle : {};
		};

and in 1.7 we have:

	// Although we normally eschew argument validation at this
	// level, here we test argument 'node' for (duck)type,
	// by testing nodeType, ecause 'document' is the 'parentNode' of 'body'
	// it is frequently sent to this function even
	// though it is not Element.
	var getComputedStyle, style = {};
		if(has("webkit")){
			getComputedStyle = function(/*DomNode*/node){
			var s;
			if(node.nodeType == 1){
				var dv = node.ownerDocument.defaultView;
				s = dv.getComputedStyle(node, null);
				if(!s && node.style){
					node.style.display = "";
					s = dv.getComputedStyle(node, null);
				}
			}
			return s || {};
		};
		}else if(has("ie")){
		getComputedStyle = function(node){
			// IE (as of 7) doesn't expose Element like sane browsers
			return node.nodeType == 1 /* ELEMENT_NODE*/ ? node.currentStyle : {};
		};
	}else{
		getComputedStyle = function(node){
			return node.nodeType == 1 ?
				node.ownerDocument.defaultView.getComputedStyle(node, null) : {};
		};
	}
		style.getComputedStyle = getComputedStyle;

A user is reporting for 1.6.1 that Dijit.Editor is failing to load in IE9 because of this, and changing the IE check to IE < 9 resolves the issue. Please review/test/verify. Let me know if you need more information.

Change History (3)

comment:1 Changed 7 years ago by dylan

Owner: changed from Eugene Lazutkin to Kenneth G. Franqueiro

comment:2 Changed 7 years ago by Kenneth G. Franqueiro

Can we get more details and a reproducible test case? Editor loads fine for me in IE9 on 1.6.1 and 1.7.

comment:3 Changed 7 years ago by Kenneth G. Franqueiro

Resolution: duplicate
Status: newclosed

This seems to be referring to the same bit of code as #14103. Closing as duplicate, and perhaps we'll take another look at that one since there are some repro cases for it.

Note: See TracTickets for help on using tickets.