summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/allowed-children.html
blob: 201475d7bd289de2efe46ae887f6c9e2a243a9ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<html>
<head>
<script src="../js/resources/js-test-pre.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>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>