1 <html xmlns=
"http://www.w3.org/1999/xhtml">
3 <title>Make sure embedded SVG is turned off in dashboard
</title>
7 var c
= document
.getElementById('console')
8 c
.appendChild(document
.createTextNode(str
+ '\n'));
11 if (window
.testRunner
) {
12 testRunner
.setUseDashboardCompatibilityMode(true);
13 testRunner
.dumpAsText();
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>
21 var documentString
= '<html xmlns="http://www.w3.org/1999/xhtml">' +
23 '<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400">' +
24 '<circle id="svgCircle" cx="50" cy="50" r="50" fill="red"/></svg>' +
27 // Use DOMParser interface to create a SVGDocument datastructure from SVG content string
28 var parser
= new DOMParser();
29 var xhtmlDocument
= parser
.parseFromString(documentString
, "application/xhtml+xml");
31 debug("Parsing of the document isn't prevented and produces a " + xhtmlDocument
);
32 debug("The circle element is of type " + xhtmlDocument
.getElementById('svgCircle'));
34 // Import SVG element into tree.
35 var importedNode
= null;
37 importedNode
= document
.importNode(xhtmlDocument
.firstChild
, true);
42 debug("PASS: Managed to insert SVG element into tree");
43 document
.getElementById('targetDiv').appendChild(importedNode
);
45 debug("FAIL: Could not insert SVG element into tree");