1.box {
2 position:absolute;
3 background-color:red;
4 height:10px;
5 width:10px;
6}
7
1function propertyFromStylesheet(selector, attribute) {
2 var value;
3
4 [].some.call(document.styleSheets, function (sheet) {
5 return [].some.call(sheet.rules, function (rule) {
6 if (selector === rule.selectorText) {
7 return [].some.call(rule.style, function (style) {
8 if (attribute === style) {
9 value = rule.style.getPropertyValue(attribute);
10 return true;
11 }
12
13 return false;
14 });
15 }
16
17 return false;
18 });
19 });
20
21 return value;
22}
23
24console.log(propertyFromStylesheet(".box", "height"));
25