Is there a way to map the computed style of a dom element (as retrieved by window.getComputedStyle) to a corresponding CSSStyleRule
in document.styleSheets
As far as I know, only IE (with element.currentStyle) allows JS to retrieve the specified values, which is a good thing in my opinion. All the other browsers return the computed values.
I once needed the specified value and the only thing that crossed my mind was to make a CSS parser that would map an element to a rule based on the element's xpath. It would have been some kind of a reversed jQuery, where you would supply a DOM element and it would have returned the CSS rules associated with it after parsing all the loaded CSS. Unfortunately I didn't have the time to start the project.