Ticket #5142 (closed defect: invalid)

Opened 8 months ago

Last modified 3 weeks ago

dojo.style, undefined or null error

Reported by: guest Owned by: anonymous
Priority: normal Milestone:
Component: HTML Version: 1.0
Severity: normal Keywords: dojo.style null
Cc:

Description (last modified by bill) (diff)

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

Changed 8 months ago by bill

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

Changed 5 months ago by bill

  • status changed from new to closed
  • component changed from General to HTML
  • resolution set to invalid

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

Changed 3 months ago by guest

  • status changed from closed to reopened
  • resolution deleted

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.

Changed 3 months 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.

Changed 3 weeks ago by bill

  • status changed from reopened to closed
  • resolution set to invalid

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

Note: See TracTickets for help on using tickets.