[whatwg] New method for obtaining a CSS property

Brett Zamir brettz9 at yahoo.com
Wed Jan 26 18:47:11 PST 2011

While it can already be done dynamically by iterating through 
document.stylesheets, in order to allow full separation of presentation 
from content in a convenient way and foster best practices, I think it 
would be helpful to have a built-in method to obtain a CSS property for 
a given selector.

This is particularly needed by canvas which has no inherent way of 
obtaining styles set in a stylesheet, but would also be useful for HTML 
and SVG where setting a class dynamically may not always be sufficient, 
such as in a dynamically powered transition which wants to obtain 
starting and ending style properties.

(This issue might also highlight some gaps in CSS, with, for example, 
there being no exact equivalent for say shadow color as used in canvas, 
but even without such changes to CSS, the proposed method would still be 


More information about the whatwg mailing list