<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<script>
description("This test ensures that we can attach various DOMs to the document.");
var cases = [
{
"markup": "<Long />",
"tagName": "'Long'",
"serialization": "'<Long/>'"
}, {
"markup": "<Long><b>15</b></Long>",
"tagName": "'Long'",
"serialization": "'<Long><b>15</b></Long>'"
}, {
"markup": "<Long id='1'>1</Long>",
"tagName": "'Long'",
"serialization": "'<Long id=\"1\">1</Long>'"
}, {
"markup": "<Long id='1'>15<b>1</b>16</Long>",
"tagName": "'Long'",
"serialization": "'<Long id=\"1\">15<b>1</b>16</Long>'"
}
];
for (var i = 0; i < cases.length; ++i) {
var doc = document.implementation.createDocument("", "", null);
var doc2 = (new DOMParser()).parseFromString(cases[i].markup, "text/xml");
var u = doc.importNode(doc2.childNodes[0], true);
shouldBe("u.tagName", cases[i].tagName);
doc.appendChild(u);
shouldBe("(new XMLSerializer()).serializeToString(doc)", cases[i].serialization);
}
</script>
</body>
</html>