9 background-color: blue;
13 <script src="../../../http/tests/inspector/inspector-test.js"></script>
14 <script src="../../../http/tests/inspector/elements-test.js"></script>
16 function modifyStyleAttribute()
18 document.getElementById("container").setAttribute("style", "color: #daC0DE; border: 1px solid black;");
21 function modifyCSSText()
23 document.getElementById("container").style.cssText = "color: #C0FFEE";
26 function modifyParsedAttributes()
28 var style = document.getElementById("container").style;
29 style.border = "2px dashed green";
30 style.borderWidth = "3px";
33 function modifyContainerClass()
35 document.getElementById("container").className = "red";
38 function modifyChildAttr()
40 document.getElementById("child").setAttribute("foo", "bar");
45 InspectorTest.runTestSuite([
46 function testInit(next)
48 InspectorTest.selectNodeAndWaitForStyles("container", next);
51 function testSetStyleAttribute(next)
53 waitAndDumpAttributeAndStyles(next);
54 InspectorTest.evaluateInPage("modifyStyleAttribute()");
57 function testSetStyleCSSText(next)
59 waitAndDumpAttributeAndStyles(next);
60 InspectorTest.evaluateInPage("modifyCSSText()");
63 function testSetViaParsedAttributes(next)
65 waitAndDumpAttributeAndStyles(next);
66 InspectorTest.evaluateInPage("modifyParsedAttributes()");
69 function testSetViaAncestorClass(next)
71 InspectorTest.selectNodeAndWaitForStyles("child", callback);
75 waitAndDumpAttributeAndStyles(next, "child");
76 InspectorTest.evaluateInPage("modifyContainerClass()");
80 function testSetViaSiblingAttr(next)
82 InspectorTest.selectNodeAndWaitForStyles("childSibling", callback);
86 waitAndDumpAttributeAndStyles(next, "childSibling");
87 InspectorTest.evaluateInPage("modifyChildAttr()");
92 function waitAndDumpAttributeAndStyles(next, id)
94 id = id || "container";
97 dumpAttributeAndStyles(id);
100 InspectorTest.waitForStyles(id, callback);
103 function dumpAttributeAndStyles(id)
105 var treeElement = findNodeTreeElement(id);
107 InspectorTest.addResult("'" + id + "' tree element not found");
110 InspectorTest.addResult(treeElement.listItemElement.textContent.replace(/\u200b/g, ""));
111 InspectorTest.dumpSelectedElementStyles(true);
114 function findNodeTreeElement(id)
116 InspectorTest.firstElementsTreeOutline()._updateModifiedNodes();
117 var expandedNode = InspectorTest.expandedNodeWithId(id);
119 InspectorTest.addResult("'" + id + "' node not found");
120 InspectorTest.completeTest();
122 return InspectorTest.firstElementsTreeOutline().findTreeElement(expandedNode);
128 <body onload="runTest()">
130 Tests that changes to an inline style and ancestor/sibling className from JavaScript are reflected in the Styles pane and Elements tree.
133 <div id="container" style="font-weight:bold"><div id="child"></div><div id="childSibling"></div></div>