blob: 4d675b769cddd68cd8daf485e4727f2e3eba3cc4 [file] [log] [blame]
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Make sure embedded SVG is turned on 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 = '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">' +
'<circle cx="50" cy="50" r="50" fill="red"/></svg>';
// Use DOMParser interface to create a SVGDocument datastructure from SVG content string
var parser = new DOMParser();
var svgDocument = parser.parseFromString(documentString, "image/svg+xml");
debug("Parsing of the document isn't prevented and produces a " + svgDocument);
// Import SVG element into tree.
var importedNode = null;
try {
importedNode = document.importNode(svgDocument.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>