blob: d043c523932b17cdcb27fe3fd2ee103c4799a255 [file] [log] [blame]
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Make sure embedded SVG is turned off in dashboard</title>
</head>
<script>
function debug(str) {
var c = document.getElementById('console')
c.appendChild(document.createTextNode(str + '\n'));
}
if (window.testRunner) {
testRunner.setUseDashboardCompatibilityMode(true);
testRunner.dumpAsText();
}
</script>
<body>
<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>
<div id="targetDiv"></div>
<pre id="console"></pre>
<script>
var documentString = '<html xmlns="http://www.w3.org/1999/xhtml">' +
'<body>' +
'<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400">' +
'<circle id="svgCircle" cx="50" cy="50" r="50" fill="red"/></svg>' +
'</body></html>';
// Use DOMParser interface to create a SVGDocument datastructure from SVG content string
var parser = new DOMParser();
var xhtmlDocument = parser.parseFromString(documentString, "application/xhtml+xml");
debug("Parsing of the document isn't prevented and produces a " + xhtmlDocument);
debug("The circle element is of type " + xhtmlDocument.getElementById('svgCircle'));
// Import SVG element into tree.
var importedNode = null;
try {
importedNode = document.importNode(xhtmlDocument.firstChild, true);
} catch(e) {
}
if (importedNode) {
debug("PASS: Managed to insert SVG element into tree");
document.getElementById('targetDiv').appendChild(importedNode);
} else {
debug("FAIL: Could not insert SVG element into tree");
}
</script>
</body>
</html>