Archive for the ‘Web development’ Category

getComputedStyle() properties in Webkit

Friday, February 6th, 2009

The getComputedStyle() method is used when you want to get the style information of an HTML element. If you use the style property, you only get the inline style, but getComputedStyle() gives you what is set in the stylesheets. IE has an almost-similar property called currentStyle, and although they don’t work the same way they mostly give you cross-browser functionality.

In Safari and Chrome, getComputedStyle() has properties for each of the CSS props that getComputedStyle() in Webkit can extract. This makes it easy to loop these and seeĀ  these properties, which is useful since some of the CSS 2.1 stuff that Webkit supports in CSS is missing, like “content”. (This is reported as a bug in Webkit. Thanks to Mark Rowe for pointing this out).

The list contains some 50 “-webkit-” vendor specific properties and some SVG stuff.

The whole list is available at this page.