<!doctype html>
<head>
    <script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<div id="container"><FOO><foo><linearGradient/></foo></FOO><img/></div>

<script>
if (window.testRunner)
    testRunner.dumpAsText();

var container = document.getElementById('container');
var svgdoc = new DOMParser().parseFromString(
	'<svg xmlns="http://www.w3.org/2000/svg"><linearGradient></linearGradient><img/></svg>', 'text/xml');

var elem = document.importNode(svgdoc.documentElement,true);
container.appendChild(elem);

shouldBe("container.getElementsByTagName('linearGradient').length", "2");
shouldBe("container.getElementsByTagName('lineargradient').length", "1");
shouldBe("container.getElementsByTagName('LINEARGRADIENT').length", "1");
shouldBe("container.getElementsByTagName('FOO').length", "2");
shouldBe("container.getElementsByTagName('foo').length", "2");
shouldBe("container.getElementsByTagName('Foo').length", "2");
shouldBe("container.getElementsByTagName('img').length", "2");
shouldBe("container.getElementsByTagName('IMG').length", "1");

shouldBe("container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'linearGradient').length", "1");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'lineargradient').length", "0");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'LINEARGRADIENT').length", "0");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'FOO').length", "0");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'foo').length", "0");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'Foo').length", "0");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'img').length", "1");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'IMG').length", "0");

shouldBe("container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'linearGradient').length", "0");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'lineargradient').length", "1");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'LINEARGRADIENT').length", "0");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'FOO').length", "0");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'foo').length", "2");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'Foo').length", "0");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'img').length", "1");
shouldBe("container.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'IMG').length", "0");
</script>
</body>
