6 box-sizing: border-box;
20 box-sizing: border-box;
30 box-sizing: border-box;
38 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
39 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/css-protocol-test.js"></script>
40 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/dom-protocol-test.js"></script>
41 <script type=
"text/javascript">
47 InspectorTest
.requestDocumentNodeId(onDocumentNodeId
);
49 function onDocumentNodeId(nodeId
)
51 documentNodeId
= nodeId
;
52 InspectorTest
.sendCommandOrDie("CSS.enable", {}, function() {
53 InspectorTest
.runTestSuite(testSuite
);
58 function testModifyRule(next
)
60 InspectorTest
.log("--------------");
61 InspectorTest
.log("Original rule:");
62 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#modifyRule", step1
, true);
66 InspectorTest
.evaluateInPage("document.styleSheets[0].rules[0].style.setProperty('color', 'red')");
67 InspectorTest
.log("--------------");
68 InspectorTest
.log("Modified rule 1:");
69 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#modifyRule", step2
, true);
74 InspectorTest
.evaluateInPage("document.styleSheets[0].rules[2].style.setProperty('color', 'blue')");
75 InspectorTest
.log("---------------");
76 InspectorTest
.log("Modified rule 3:");
77 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#modifyRule", step3
, true);
82 InspectorTest
.evaluateInPage("document.styleSheets[0].rules[1].style.setProperty('color', 'green')");
83 InspectorTest
.log("---------------");
84 InspectorTest
.log("Modified rule 2:");
85 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#modifyRule", step4
, true);
90 InspectorTest
.evaluateInPage("document.styleSheets[0].rules[1].style.removeProperty('color')");
91 InspectorTest
.log("---------------");
92 InspectorTest
.log("Restored rule 2:");
93 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#modifyRule", step5
, true);
98 InspectorTest
.evaluateInPage("document.styleSheets[0].rules[0].style.removeProperty('color')");
99 InspectorTest
.evaluateInPage("document.styleSheets[0].rules[2].style.removeProperty('color')");
100 InspectorTest
.log("-----------------");
101 InspectorTest
.log("Restored rule 1,3:");
102 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#modifyRule", next
, true);
106 function testInsertFirstRule(next
)
108 testInsertRule(0, next
)
111 function testInsertMiddleRule(next
)
113 testInsertRule(1, next
)
116 function testInsertLastRule(next
)
118 testInsertRule(2, next
)
121 function testRemoveRule(next
)
123 InspectorTest
.log("Original rule:");
124 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#removeRule", step1
, true);
128 InspectorTest
.evaluateInPage("document.styleSheets[2].removeRule(0)");
129 InspectorTest
.log("-------------------");
130 InspectorTest
.log("After remove rule 1:");
131 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#removeRule", step2
, true);
136 InspectorTest
.evaluateInPage("document.styleSheets[2].removeRule(0)");
137 InspectorTest
.log("-------------------");
138 InspectorTest
.log("After remove rule 2:");
139 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#removeRule", next
, true);
145 function testInsertRule(index
, next
)
147 InspectorTest
.log("Original rule:");
148 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#insertRule", step1
, true);
152 InspectorTest
.evaluateInPage("document.styleSheets[1].insertRule('#insertRule { color: red }', " + index
+ ")");
153 InspectorTest
.log("--------------");
154 InspectorTest
.log("After inserted rule:");
155 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#insertRule", step2
, true);
160 InspectorTest
.evaluateInPage("document.styleSheets[1].removeRule(" + index
+ ")");
161 InspectorTest
.log("--------------");
162 InspectorTest
.log("Restored rule:");
163 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#insertRule", next
, true);
170 <body onload=
"runTest();">
171 <p>The test verifies CSS.getMatchedStylesForNode when used concurrently with the CSSOM modifications.
</p>
172 <article id=
"modifyRule"></article>
173 <article id=
"insertRule"></article>
174 <article id=
"removeRule"></article>