4 <link rel="stylesheet" href="resources/styles-source-offsets.css">
6 <script src="../../http/tests/inspector/inspector-test.js"></script>
7 <script src="../../http/tests/inspector/elements-test.js"></script>
12 function dumpStyleData(ruleOrStyle)
14 var isRule = !!(ruleOrStyle.style);
18 if (ruleOrStyle.origin !== "regular")
20 style = ruleOrStyle.style;
21 header = ruleOrStyle.selectorText + ": [" + (ruleOrStyle.selectorRange ? ruleOrStyle.selectorRange.start + "-" + ruleOrStyle.selectorRange.end : "") + "]";
24 header = "element.style:";
26 InspectorTest.addResult(header + " " + InspectorTest.rangeText(style.range));
27 var allProperties = style.cssProperties;
28 for (var i = 0; i < allProperties.length; ++i) {
29 var property = allProperties[i];
32 InspectorTest.addResult("['" + property.name + "':'" + property.value + "'" + (property.priority ? " !important" : "") + (("parsedOk" in property) ? " non-parsed" : "") +"] @" + InspectorTest.rangeText(property.range));
36 InspectorTest.selectNodeWithId("mainBody", step1);
38 var resultStyles = {};
40 function inlineCallback(error, inlineStyle)
43 InspectorTest.addResult("error: " + error);
44 InspectorTest.completeTest();
48 resultStyles.inlineStyle = inlineStyle;
51 function matchedCallback(error, matchedCSSRules)
54 InspectorTest.addResult("error: " + error);
55 InspectorTest.completeTest();
58 resultStyles.matchedCSSRules = matchedCSSRules;
64 CSSAgent.getInlineStylesForNode(node.id, inlineCallback);
65 CSSAgent.getMatchedStylesForNode(node.id, matchedCallback);
70 var matchedCSSRules = resultStyles.matchedCSSRules;
71 for (var i = 0; i < matchedCSSRules.length; ++i)
72 dumpStyleData(matchedCSSRules[i]);
73 dumpStyleData(resultStyles.inlineStyle);
74 InspectorTest.completeTest();
83 text-decoration: none; /* at least one valid property is necessary for WebCore to match a rule */
84 badproperty: 1badvalue1;
90 <body id="mainBody" class="main1 main2 mainpage" onload="runTest()" style="font-weight: normal; width: 80%">
92 Tests that proper data and start/end offset positions are reported for CSS style declarations and properties.