blob: d7613701f61846a7e02e7f485e09da7a7f951bc9 [file] [log] [blame]
<!DOCTYPE html>
<p>Test of createContextualFragment from a Range whose container is an SVG document with no &lt;svg&gt; element. If the test succeeds you will see the word "PASS" below.</p>
<p id="result"></p>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function onSvgLoad()
{
window.svgDocument = document.getElementById('container').getSVGDocument();
window.range = svgDocument.createRange();
window.fragment = range.createContextualFragment('<text id="fragment" x="0" y="16" fontsize="16">Inserted fragment</text>');
window.svg = svgDocument.createElementNS('http://www.w3.org/2000/svg', 'svg');
svg.setAttribute('width', '300px');
svg.setAttribute('height', '50px');
svg.setAttribute('viewBox', '0 0 300 24');
svgDocument.appendChild(svg);
svg.appendChild(fragment);
window.text = svgDocument.getElementById('fragment');
window.result = document.getElementById('result');
result.textContent = (text && text.parentElement === svg && text.namespaceURI === 'http://www.w3.org/2000/svg') ? 'PASS' : 'FAIL';
if (window.testRunner)
testRunner.notifyDone();
}
</script>
<embed id="container" src="resources/empty-svg-file.svg" onload="onSvgLoad();" />
</embed>