Posted By

Jman on 03/28/09


css javascript DOM

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


getComputedStyle for IE

 / Published in: JavaScript

fix for IE, adds getComputedStyle method for the object window and getPropertyValue method for the object, which returns getComputedStyle

Report this snippet  


RSS Icon Subscribe to comments
Posted By: RobertWHurst on September 20, 2012

This doesn't work correctly. GetComputed styles will always return a pixel value if possible. currentStyle returns the raw value.

for example if I have an element with a width of 50% get computed style would give me the width in pixels. You polyfill would incorrectly give me 50% instead of a pixel value.

You need to login to post a comment.