42 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
43 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/css-protocol-test.js"></script>
44 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/dom-protocol-test.js"></script>
45 <script type=
"text/javascript">
51 InspectorTest
.requestDocumentNodeId(onDocumentNodeId
);
53 function onDocumentNodeId(nodeId
)
55 documentNodeId
= nodeId
;
56 InspectorTest
.sendCommandOrDie("CSS.enable", {}, function() {
57 InspectorTest
.runTestSuite(testSuite
);
62 function testModifyRule(next
)
64 InspectorTest
.log("--------------");
65 InspectorTest
.log("Original rule:");
66 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#test", step1
, true);
70 InspectorTest
.log("Mutating 3rd:");
71 InspectorTest
.log("---------------");
72 InspectorTest
.evaluateInPage("document.styleSheets[0].rules[3].style.setProperty('color', 'red')");
73 InspectorTest
.evaluateInPage("document.styleSheets[0].rules[3].style.removeProperty('width')");
74 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#test", step2
, true);
79 InspectorTest
.log("Mutating 4th:");
80 InspectorTest
.log("--------------");
81 InspectorTest
.evaluateInPage("document.styleSheets[0].rules[4].style.setProperty('color', 'green')");
82 InspectorTest
.evaluateInPage("document.styleSheets[0].rules[4].style.removeProperty('width')");
83 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#test", step3
, true);
88 InspectorTest
.log("Mutating 5th:");
89 InspectorTest
.log("--------------");
90 InspectorTest
.evaluateInPage("document.styleSheets[0].rules[5].style.setProperty('color', 'blue')");
91 InspectorTest
.evaluateInPage("document.styleSheets[0].rules[5].style.removeProperty('width')");
92 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#test", step4
, true);
97 InspectorTest
.log("Delete first 3:");
98 InspectorTest
.log("---------------");
99 InspectorTest
.evaluateInPage("for (var i = 0; i < 3; ++i) document.styleSheets[0].removeRule(0);");
100 InspectorTest
.loadAndDumpMatchingRules(documentNodeId
, "#test", next
, true);
108 <body onload=
"runTest();">
109 <p>The test verifies CSS.getMatchedStylesForNode when used concurrently with multiple CSSOM modifications.
</p>
110 <article id=
"test"></article>