1 function testAsChild(tag)
3 var markup = "<p>1<" + tag + ">";
4 var container = document.createElement("body");
6 container.innerHTML = markup;
8 if (container.childNodes.length == 1)
11 if (container.lastChild.tagName.toLowerCase() == tag)
17 function testAsGrandchild(tag, intermediateTag)
19 var markup = "<p>1<" + intermediateTag + ">2<" + tag + ">3";
20 var container = document.createElement("body");
21 container.innerHTML = markup;
23 if (container.childNodes.length == 1)
25 if (container.firstChild.lastChild && container.firstChild.lastChild.tagName && container.firstChild.lastChild.tagName.toLowerCase() == tag)
33 document.getElementById("console").appendChild(document.createTextNode(message + "\n\r"));
72 var intermediateTags = [
80 "small", // formatting
81 "strike", // formatting
82 "strong", // formatting
101 "nobr", // formatting
111 "marquee", // scoping
114 if (window.testRunner)
115 testRunner.dumpAsText();
117 var headerRow = document.getElementById("header-row");
118 for (var i = 0; i < intermediateTags.length; ++i)
119 headerRow.appendChild(document.createElement("th")).appendChild(document.createTextNode(intermediateTags[i]));
121 for (var i = 0; i < leafTags.length; ++i) {
122 var tag = leafTags[i];
123 var row = document.getElementById("results").appendChild(document.createElement("tr"));
124 row.appendChild(document.createElement("td")).appendChild(document.createTextNode(tag));
125 var asChild = testAsChild(tag);
126 var cell = row.appendChild(document.createElement("td"));
127 cell.className = asChild;
128 cell.appendChild(document.createTextNode(asChild == "allowed" ? "+" : asChild == "closed" ? "-" : "?"));
129 for (var j = 0; j < intermediateTags.length; ++j) {
130 var intermediateTag = intermediateTags[j];
131 var asGrandchild = testAsGrandchild(tag, intermediateTag);
132 cell = row.appendChild(document.createElement("td"));
133 cell.className = asGrandchild;
134 cell.appendChild(document.createTextNode(asGrandchild == "allowed" ? "+" : asGrandchild == "closed" ? "-" : "?"));