3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/elements-test.js"></script>
6 /* comment */.inline-style-added-by-parser {
11 .inline-style-added-by-parser-with-source-url {
14 /*# sourceURL=inlineStyleAddedByParser.css*/
17 document.write("<style>\n.inline-style-added-by-parser-in-document-write {\n color: blue;\n}\n</style>");
18 document.write("<style>\n.inline-style-added-by-document-write-with-source-url {\n color: yellow;\n}\n/*# sourceURL=inlineStyleAddedByDocumentWrite.css*/\n</style>");
19 addStyleElement(".inline-style-created-by-script {\n color: orange;\n}");
20 addStyleElement(".inline-style-created-by-script-with-source-url {\n color: grey;\n}\n/*# sourceURL=inlineStyleCreatedByScript.css*/");
22 function addStyleElement(styleContent)
24 var styleElement = document.createElement("style");
25 styleElement.textContent = styleContent;
26 document.head.appendChild(styleElement);
31 InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
35 var styleSheets = WebInspector.cssModel.allStyleSheets();
37 for (var i = 0; i < styleSheets.length; ++i)
38 CSSAgent.getStyleSheetText(styleSheets[i].id, dumpStyleSheet.bind(null, styleSheets[i], i === styleSheets.length - 1));
41 function dumpStyleSheet(header, isLast, error, content, callback)
43 InspectorTest.addResult("Stylesheet added:");
44 InspectorTest.addResult(" - isInline: " + header.isInline);
45 InspectorTest.addResult(" - sourceURL: " + header.sourceURL.substring(header.sourceURL.lastIndexOf("/") + 1));
46 InspectorTest.addResult(" - hasSourceURL: " + header.hasSourceURL);
47 InspectorTest.addResult(" - contents: " + content);
49 InspectorTest.dumpSelectedElementStyles(true, false, true);
50 InspectorTest.completeTest();
56 <body onload="runTest()">
57 <p>Tests that different types of inline styles are correctly disambiguated and their sourceURL is correct.
58 <div id="inspected" style="color:red" class="inline-style-added-by-parser inline-style-added-by-parser-with-source-url inline-style-added-by-parser-in-document-write inline-style-added-by-document-write-with-source-url inline-style-created-by-script inline-style-created-by-script-with-source-url"></div>