This project is archived and is in readonly mode.

#786 ✓resolved

'this.getDocument().defaultView' is null on IE when using getStyle

Reported by Arieh | November 16th, 2009 @ 08:24 AM | in 1.3.0 rc2 (closed)

i'm using a getStyle on an element with a class that was not yet placed in the DOM. this triggers an error in IE that breaks the code.
the problematic part that breaks is this one (line 1916 on core v1.2.4):

if (this.currentStyle) return this.currentStyle[property.camelCase()];
var computed = this.getDocument().defaultView.getComputedStyle(this, null);
return (computed) ? computed.getPropertyValue([property.hyphenate()]) : null;
basically, as i understand this, IE doesn't have a currentStyle when the element is not in the DOM. this happens in all IEs i checked - 6-8. i fixed this by adding a check whether or not the property exists, then if getComputedSize exsits, then return false.

the code that's generating the error is on file

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins