Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / custom / manually-parsed-svg-allowed-in-dashboard.html
blob4d675b769cddd68cd8daf485e4727f2e3eba3cc4
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
3 <title>Make sure embedded SVG is turned on in dashboard</title>
4 </head>
5 <script>
6 function debug(str) {
7 var c = document.getElementById('console')
8 c.appendChild(document.createTextNode(str + '\n'));
11 if (window.testRunner) {
12 testRunner.setUseDashboardCompatibilityMode(true);
13 testRunner.dumpAsText();
15 </script>
16 <body>
17 <p>This test makes sure we can add manually parsed SVG to the document when in dashboard compatibility mode. It can not be tested manually.</p>
18 <div id="targetDiv"></div>
19 <pre id="console"></pre>
20 <script>
21 var documentString = '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">' +
22 '<circle cx="50" cy="50" r="50" fill="red"/></svg>';
24 // Use DOMParser interface to create a SVGDocument datastructure from SVG content string
25 var parser = new DOMParser();
26 var svgDocument = parser.parseFromString(documentString, "image/svg+xml");
28 debug("Parsing of the document isn't prevented and produces a " + svgDocument);
30 // Import SVG element into tree.
31 var importedNode = null;
32 try {
33 importedNode = document.importNode(svgDocument.firstChild, true);
34 } catch(e) {
37 if (importedNode) {
38 debug("PASS: Managed to insert SVG element into tree");
39 document.getElementById('targetDiv').appendChild(importedNode);
40 } else {
41 debug("FAIL: Could not insert SVG element into tree");
43 </script>
44 </body>
45 </html>