Если вас правильно понял, вот ~ код:
var slice = Array.prototype.slice,
filter = Array.prototype.filter
;
function findSelector(cssProperty){
var rules = [];
filter
.call(document.styleSheets, hasRules)
.forEach(function(styleSheet){
rules = rules.concat(slice
.call(styleSheet.rules)
.filter(hasCssNameDelegate(cssProperty))
);
})
return rules.map(function(rule){
return {
selector: rule.selectorText,
value: rule.style[cssProperty]
};
});
function hasRules(styleSheets){
return styleSheets.rules != null
}
function hasCssNameDelegate(name) {
return function(cssRule){
return cssRule.style && slice.call(cssRule.style).indexOf(name) !== -1
};
}
}
function findSelectorForElement(element, cssProperty){
var matchesSelector = HTMLElement.prototype.webkitMatchesSelector
|| HTMLElement.prototype.mozMatchesSelector
|| HTMLElement.prototype.msMatchesSelector
|| HTMLElement.prototype.oMatchesSelector
;
return findSelector(cssProperty)
.filter(function(data){
return matchesSelector.call(element, data.selector);
}).slice(-1)[0];
}
var tosterSidebar = document.querySelector('.sidebar')
findSelectorForElement(tosterSidebar, 'width');