Opened 12 years ago

Closed 11 years ago

#5142 closed defect (invalid)

dojo.style, undefined or null error

Reported by: guest Owned by: anonymous
Priority: high Milestone:
Component: HTML Version: 1.0
Keywords: dojo.style null Cc:
Blocked By: Blocking:

Description (last modified by bill)

var gcs, dv = document.defaultView;
if(dojo.isSafari){
	......
}else if(dojo.isIE){
	gcs = function(node){
		return node.currentStyle || {};
//here "||{}" should added ,or sometimes null is returned
	};
}else{
	gcs = function(node){
		return dv.getComputedStyle(node, null) || {};
//here "||{}" should added ,or sometimes null is returned
	};
}
dojo.getComputedStyle = gcs;

Change History (5)

comment:1 Changed 12 years ago by bill

Please attach test case using the "attach file" button.

comment:2 Changed 11 years ago by bill

Component: GeneralHTML
Resolution: invalid
Status: newclosed

Closing since no test case provided (waited 2 months).

comment:3 Changed 11 years ago by guest

Resolution: invalid
Status: closedreopened

I'm seeing either the same or a closely related problem, so I've reopened this.

With IE7, I'm getting an intermittent error generated at line 279 of dojo/_base/html.js. I'm using the 1.1.0-src release, not the current trunk.

var gcs, dv = document.defaultView;

if(d.isSafari){

....

}else if(d.isIE){

gcs = function(node){

return node.currentStyle; <<< 279

};

The error reported is "Error: 'currentStyle' is null or not an object". Actually, it's node being undefined that seems to be the problem. Trying to access a property of a null/undefined object seems to upset IE.

The OP's solution doesn't work for me (so perhaps this is a new bug). Instead, I'm using an explicit null check on node as a workaround.

I'd love to be able to provide a test case, but unfortunately I can't - I haven't been able to reproduce the problem with a simple page, and my employer wouldn't appreciate it if I posted the code I'm working on. If I come up with anything I'll come back and attach it.

I'm seeing the error (when I see it at all; averages maybe one page load in ten) the first time the mouse moves on the page after load. The page in question uses dojo.connect to handle mouseover and mouseout events.

comment:4 Changed 11 years ago by bill

Description: modified (diff)

Unfortunately we still need a test case. The only other option is if you install a debugger for IE (or maybe add some console.log() statements to figure out what's going on. My wild guess it has something to do with code in dijit/_base/focus.js or somewhere that traces up a tree of DOM objects trying to find a certain ancestor... but that's just a wild guess.

comment:5 Changed 11 years ago by bill

Resolution: invalid
Status: reopenedclosed

Closing until we get a test case. If you provide one then reopen the ticket.

Note: See TracTickets for help on using tickets.