element: implement parenteNode accessors
20
tests/wpt/dom/Element-childElement-null-svg.svg
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:h="http://www.w3.org/1999/xhtml"
|
||||
version="1.1"
|
||||
width="100%" height="100%" viewBox="0 0 400 400">
|
||||
<title>Null test</title>
|
||||
<h:script src="/resources/testharness.js"/>
|
||||
<h:script src="/resources/testharnessreport.js"/>
|
||||
|
||||
<text x="200" y="40" font-size="25" fill="black" text-anchor="middle">Test of firstElementChild and lastChildElement returning null</text>
|
||||
<text id="parentEl" x="200" y="70" font-size="20" fill="black" text-anchor="middle" font-weight="bold">Test</text>
|
||||
|
||||
<h:script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl")
|
||||
assert_equals(parentEl.firstElementChild, null)
|
||||
assert_equals(parentEl.lastElementChild, null)
|
||||
})
|
||||
]]></h:script>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 787 B |
20
tests/wpt/dom/Element-childElement-null-xhtml.xhtml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Null Test</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test of firstElementChild and lastChildElement returning null</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl" style="font-weight:bold;">Test.</p>
|
||||
<script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl")
|
||||
assert_equals(parentEl.firstElementChild, null)
|
||||
assert_equals(parentEl.lastElementChild, null)
|
||||
})
|
||||
]]></script>
|
||||
</body>
|
||||
</html>
|
||||
15
tests/wpt/dom/Element-childElement-null.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>Null test</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<h1>Test of firstElementChild and lastChildElement returning null</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl" style="font-weight:bold;">Test.</p>
|
||||
<script>
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl")
|
||||
assert_equals(parentEl.firstElementChild, null)
|
||||
assert_equals(parentEl.lastElementChild, null)
|
||||
})
|
||||
</script>
|
||||
22
tests/wpt/dom/Element-childElementCount-dynamic-add-svg.svg
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:h="http://www.w3.org/1999/xhtml"
|
||||
version="1.1"
|
||||
width="100%" height="100%" viewBox="0 0 400 400">
|
||||
<title>Dynamic Adding of Elements</title>
|
||||
<h:script src="/resources/testharness.js"/>
|
||||
<h:script src="/resources/testharnessreport.js"/>
|
||||
|
||||
<text x="200" y="40" font-size="25" fill="black" text-anchor="middle">Test of Dynamic Adding of Elements</text>
|
||||
<text id="parentEl" x="200" y="70" font-size="20" fill="black" text-anchor="middle">The result of this test is
|
||||
<tspan id="first_element_child" font-weight="bold">unknown.</tspan></text>
|
||||
|
||||
<h:script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var newChild = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
||||
parentEl.appendChild(newChild);
|
||||
assert_equals(parentEl.childElementCount, 2)
|
||||
})
|
||||
]]></h:script>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 913 B |
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Dynamic Adding of Elements</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test of Dynamic Adding of Elements</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl">The result of this test is
|
||||
<span id="first_element_child" style="font-weight:bold;">logged above.</span></p>
|
||||
<script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var newChild = document.createElement("span");
|
||||
parentEl.appendChild(newChild);
|
||||
assert_equals(parentEl.childElementCount, 2)
|
||||
})
|
||||
]]></script>
|
||||
</body>
|
||||
</html>
|
||||
17
tests/wpt/dom/Element-childElementCount-dynamic-add.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>Dynamic Adding of Elements</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<h1>Test of Dynamic Adding of Elements</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl">The result of this test is
|
||||
<span id="first_element_child" style="font-weight:bold;">logged above.</span></p>
|
||||
<script>
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var newChild = document.createElement("span");
|
||||
parentEl.appendChild(newChild);
|
||||
assert_equals(parentEl.childElementCount, 2)
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:h="http://www.w3.org/1999/xhtml"
|
||||
version="1.1"
|
||||
width="100%" height="100%" viewBox="0 0 400 400">
|
||||
<title>Dynamic Removal of Elements</title>
|
||||
<h:script src="/resources/testharness.js"/>
|
||||
<h:script src="/resources/testharnessreport.js"/>
|
||||
|
||||
<text x="200" y="40" font-size="25" fill="black" text-anchor="middle">Test of Dynamic Removal of Elements</text>
|
||||
<text id="parentEl" x="200" y="70" font-size="20" fill="black" text-anchor="middle">The result of this test is
|
||||
<tspan id="first_element_child" font-weight="bold">unknown.</tspan><tspan id="last_element_child"> </tspan></text>
|
||||
|
||||
<h:script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var lec = parentEl.lastElementChild;
|
||||
parentEl.removeChild(lec);
|
||||
assert_equals(parentEl.childElementCount, 1)
|
||||
})
|
||||
]]></h:script>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 907 B |
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Dynamic Removal of Elements</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test of Removal Adding of Elements</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl">The result of this test is
|
||||
<span id="first_element_child" style="font-weight:bold;">logged above.</span><span id="last_element_child"> </span></p>
|
||||
<script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var lec = parentEl.lastElementChild;
|
||||
parentEl.removeChild(lec);
|
||||
assert_equals(parentEl.childElementCount, 1)
|
||||
})
|
||||
]]></script>
|
||||
</body>
|
||||
</html>
|
||||
17
tests/wpt/dom/Element-childElementCount-dynamic-remove.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>Dynamic Removal of Elements</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<h1>Test of Dynamic Removal of Elements</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl">The result of this test is
|
||||
<span id="first_element_child" style="font-weight:bold;">unknown.</span><span id="last_element_child"> </span></p>
|
||||
<script>
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var lec = parentEl.lastElementChild;
|
||||
parentEl.removeChild(lec);
|
||||
assert_equals(parentEl.childElementCount, 1)
|
||||
})
|
||||
</script>
|
||||
19
tests/wpt/dom/Element-childElementCount-nochild-svg.svg
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:h="http://www.w3.org/1999/xhtml"
|
||||
version="1.1"
|
||||
width="100%" height="100%" viewBox="0 0 400 400">
|
||||
<title>childElementCount</title>
|
||||
<h:script src="/resources/testharness.js"/>
|
||||
<h:script src="/resources/testharnessreport.js"/>
|
||||
|
||||
<text x="200" y="40" font-size="25" fill="black" text-anchor="middle">Test of childElementCount with No Child Element Nodes</text>
|
||||
<text id="parentEl" x="200" y="70" font-size="20" fill="black" text-anchor="middle" font-weight="bold">Test</text>
|
||||
|
||||
<h:script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl")
|
||||
assert_equals(parentEl.childElementCount, 0)
|
||||
})
|
||||
]]></h:script>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 735 B |
19
tests/wpt/dom/Element-childElementCount-nochild-xhtml.xhtml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>childElementCount without Child Element Nodes</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test of childElementCount with No Child Element Nodes</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl" style="font-weight:bold;">Test.</p>
|
||||
<script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl")
|
||||
assert_equals(parentEl.childElementCount, 0)
|
||||
})
|
||||
]]></script>
|
||||
</body>
|
||||
</html>
|
||||
14
tests/wpt/dom/Element-childElementCount-nochild.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>childElementCount without Child Element Nodes</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<h1>Test of childElementCount with No Child Element Nodes</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl" style="font-weight:bold;">Test.</p>
|
||||
<script>
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl")
|
||||
assert_equals(parentEl.childElementCount, 0)
|
||||
})
|
||||
</script>
|
||||
25
tests/wpt/dom/Element-childElementCount-svg.svg
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:h="http://www.w3.org/1999/xhtml"
|
||||
version="1.1"
|
||||
width="100%" height="100%" viewBox="0 0 400 400">
|
||||
<title>childElementCount</title>
|
||||
<h:script src="/resources/testharness.js"/>
|
||||
<h:script src="/resources/testharnessreport.js"/>
|
||||
|
||||
<text x="200" y="40" font-size="25" fill="black" text-anchor="middle">Test of childElementCount</text>
|
||||
<text id="parentEl" x="200" y="70" font-size="20" fill="black" text-anchor="middle">The result of <tspan id="first_element_child"><tspan>this</tspan> <tspan>test</tspan></tspan> is
|
||||
<tspan id="middle_element_child" font-weight="bold">unknown.</tspan>
|
||||
|
||||
|
||||
|
||||
<tspan id="last_element_child" style="display:none;">fnord</tspan> </text>
|
||||
|
||||
<h:script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl")
|
||||
assert_true("childElementCount" in parentEl)
|
||||
assert_equals(parentEl.childElementCount, 3)
|
||||
})
|
||||
]]></h:script>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 967 B |
25
tests/wpt/dom/Element-childElementCount-xhtml.xhtml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>childElementCount</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test of childElementCount</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl">The result of <span id="first_element_child"><span>this</span> <span>test</span></span> is
|
||||
<span id="middle_element_child" style="font-weight:bold;">unknown.</span>
|
||||
|
||||
|
||||
|
||||
<span id="last_element_child" style="display:none;">fnord</span> </p>
|
||||
<script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl")
|
||||
assert_true("childElementCount" in parentEl)
|
||||
assert_equals(parentEl.childElementCount, 3)
|
||||
})
|
||||
]]></script>
|
||||
</body>
|
||||
</html>
|
||||
20
tests/wpt/dom/Element-childElementCount.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>childElementCount</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<h1>Test of childElementCount</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl">The result of <span id="first_element_child"><span>this</span> <span>test</span></span> is
|
||||
<span id="middle_element_child" style="font-weight:bold;">given above.</span>
|
||||
|
||||
|
||||
|
||||
<span id="last_element_child" style="display:none;">fnord</span> </p>
|
||||
<script>
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl")
|
||||
assert_true("childElementCount" in parentEl)
|
||||
assert_equals(parentEl.childElementCount, 3)
|
||||
})
|
||||
</script>
|
||||
58
tests/wpt/dom/Element-children.html
Normal file
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<title>HTMLCollection edge cases</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<div id="test"><img><img id=foo><img id=foo><img name="bar"></div>
|
||||
<script>
|
||||
setup(function() {
|
||||
// Add some non-HTML elements in there to test what happens with those.
|
||||
var container = document.getElementById("test");
|
||||
var child = document.createElementNS("", "img");
|
||||
child.setAttribute("id", "baz");
|
||||
container.appendChild(child);
|
||||
|
||||
child = document.createElementNS("", "img");
|
||||
child.setAttribute("name", "qux");
|
||||
container.appendChild(child);
|
||||
});
|
||||
|
||||
test(function() {
|
||||
var container = document.getElementById("test");
|
||||
var result = container.children.item("foo");
|
||||
assert_true(result instanceof Element, "Expected an Element.");
|
||||
assert_false(result.hasAttribute("id"), "Expected the IDless Element.")
|
||||
})
|
||||
|
||||
test(function() {
|
||||
var container = document.getElementById("test");
|
||||
var list = container.children;
|
||||
var result = [];
|
||||
for (var p in list) {
|
||||
if (list.hasOwnProperty(p)) {
|
||||
result.push(p);
|
||||
}
|
||||
}
|
||||
assert_array_equals(result, ['0', '1', '2', '3', '4', '5']);
|
||||
result = Object.getOwnPropertyNames(list);
|
||||
assert_array_equals(result, ['0', '1', '2', '3', '4', '5', 'foo', 'bar', 'baz']);
|
||||
|
||||
// Mapping of exposed names to their indices in the list.
|
||||
var exposedNames = { 'foo': 1, 'bar': 3, 'baz': 4 };
|
||||
for (var exposedName in exposedNames) {
|
||||
assert_true(exposedName in list);
|
||||
assert_true(list.hasOwnProperty(exposedName));
|
||||
assert_equals(list[exposedName], list.namedItem(exposedName));
|
||||
assert_equals(list[exposedName], list.item(exposedNames[exposedName]));
|
||||
assert_true(list[exposedName] instanceof Element);
|
||||
}
|
||||
|
||||
var unexposedNames = ['qux'];
|
||||
for (var unexposedName of unexposedNames) {
|
||||
assert_false(unexposedName in list);
|
||||
assert_false(list.hasOwnProperty(unexposedName));
|
||||
assert_equals(list[unexposedName], undefined);
|
||||
assert_equals(list.namedItem(unexposedName), null);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
27
tests/wpt/dom/Element-firstElementChild-entity-xhtml.xhtml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
|
||||
[
|
||||
<!ENTITY tree "<span id='first_element_child' style='font-weight:bold;'>unknown.</span>">
|
||||
]>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Entity References</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test of Entity References</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl">The result of this test is &tree;</p>
|
||||
<script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl")
|
||||
var fec = parentEl.firstElementChild;
|
||||
assert_true(!!fec)
|
||||
assert_equals(fec.nodeType, 1)
|
||||
assert_equals(fec.getAttribute("id"), "first_element_child")
|
||||
})
|
||||
]]></script>
|
||||
</body>
|
||||
</html>
|
||||
26
tests/wpt/dom/Element-firstElementChild-entity.svg
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"
|
||||
[
|
||||
<!ENTITY tree "<tspan id='first_element_child' font-weight='bold'>unknown.</tspan>">
|
||||
]>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:h="http://www.w3.org/1999/xhtml"
|
||||
version="1.1"
|
||||
width="100%" height="100%" viewBox="0 0 400 400">
|
||||
<title>Entity References</title>
|
||||
<h:script src="/resources/testharness.js"/>
|
||||
<h:script src="/resources/testharnessreport.js"/>
|
||||
|
||||
<text x="200" y="40" font-size="25" fill="black" text-anchor="middle">Test of Entity References</text>
|
||||
<text id="parentEl" x="200" y="70" font-size="20" fill="black" text-anchor="middle">The result of this test is &tree;</text>
|
||||
|
||||
<h:script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl")
|
||||
var fec = parentEl.firstElementChild;
|
||||
assert_true(!!fec)
|
||||
assert_equals(fec.nodeType, 1)
|
||||
assert_equals(fec.getAttribute("id"), "first_element_child")
|
||||
})
|
||||
]]></h:script>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1015 B |
26
tests/wpt/dom/Element-firstElementChild-namespace-svg.svg
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:h="http://www.w3.org/1999/xhtml"
|
||||
xmlns:pickle="http://ns.example.org/pickle"
|
||||
version="1.1"
|
||||
width="100%" height="100%" viewBox="0 0 400 400">
|
||||
<title>firstElementChild with namespaces</title>
|
||||
<h:script src="/resources/testharness.js"/>
|
||||
<h:script src="/resources/testharnessreport.js"/>
|
||||
|
||||
<text x="200" y="40" font-size="25" fill="black" text-anchor="middle">Test of firstElementChild with namespaces</text>
|
||||
<g id="parentEl">
|
||||
<pickle:dill id="first_element_child"/>
|
||||
</g>
|
||||
|
||||
<h:script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var fec = parentEl.firstElementChild;
|
||||
assert_true(!!fec)
|
||||
assert_equals(fec.nodeType, 1)
|
||||
assert_equals(fec.getAttribute("id"), "first_element_child")
|
||||
assert_equals(fec.localName, "dill")
|
||||
})
|
||||
]]></h:script>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 888 B |
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:pickle="http://ns.example.org/pickle">
|
||||
<head>
|
||||
<title>firstElementChild with namespaces</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test of firstElementChild with namespaces</h1>
|
||||
<div id="parentEl">
|
||||
<pickle:dill id="first_element_child"/>
|
||||
</div>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl">The result of this test is
|
||||
<span id="first_element_child" style="font-weight:bold;">logged above.</span></p>
|
||||
<script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var fec = parentEl.firstElementChild;
|
||||
assert_true(!!fec)
|
||||
assert_equals(fec.nodeType, 1)
|
||||
assert_equals(fec.getAttribute("id"), "first_element_child")
|
||||
assert_equals(fec.localName, "dill")
|
||||
})
|
||||
]]></script>
|
||||
</body>
|
||||
</html>
|
||||
21
tests/wpt/dom/Element-firstElementChild-namespace.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>firstElementChild with namespaces</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<h1>Test of firstElementChild with namespaces</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl">The result of this test is a unknown.</p>
|
||||
<script>
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl")
|
||||
var el = document.createElementNS("http://ns.example.org/pickle", "pickle:dill")
|
||||
el.setAttribute("id", "first_element_child")
|
||||
parentEl.appendChild(el)
|
||||
var fec = parentEl.firstElementChild
|
||||
assert_true(!!fec)
|
||||
assert_equals(fec.nodeType, 1)
|
||||
assert_equals(fec.getAttribute("id"), "first_element_child")
|
||||
assert_equals(fec.localName, "dill")
|
||||
})
|
||||
</script>
|
||||
23
tests/wpt/dom/Element-firstElementChild-svg.svg
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:h="http://www.w3.org/1999/xhtml"
|
||||
version="1.1"
|
||||
width="100%" height="100%" viewBox="0 0 400 400">
|
||||
<title>firstElementChild</title>
|
||||
<h:script src="/resources/testharness.js"/>
|
||||
<h:script src="/resources/testharnessreport.js"/>
|
||||
|
||||
<text x="200" y="40" font-size="25" fill="black" text-anchor="middle">Test of firstElementChild</text>
|
||||
<text id="parentEl" x="200" y="70" font-size="20" fill="black" text-anchor="middle">The result of this test is
|
||||
<tspan id="first_element_child" font-weight="bold">unknown.</tspan></text>
|
||||
|
||||
<h:script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var fec = parentEl.firstElementChild;
|
||||
assert_true(!!fec)
|
||||
assert_equals(fec.nodeType, 1)
|
||||
assert_equals(fec.getAttribute("id"), "first_element_child")
|
||||
})
|
||||
]]></h:script>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 889 B |
23
tests/wpt/dom/Element-firstElementChild-xhtml.xhtml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>firstElementChild</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test of firstElementChild</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl">The result of this test is
|
||||
<span id="first_element_child" style="font-weight:bold;">logged above.</span></p>
|
||||
<script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var fec = parentEl.firstElementChild;
|
||||
assert_true(!!fec)
|
||||
assert_equals(fec.nodeType, 1)
|
||||
assert_equals(fec.getAttribute("id"), "first_element_child")
|
||||
})
|
||||
]]></script>
|
||||
</body>
|
||||
</html>
|
||||
18
tests/wpt/dom/Element-firstElementChild.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>firstElementChild</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<h1>Test of firstElementChild</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl">The result of this test is
|
||||
<span id="first_element_child" style="font-weight:bold;">logged above.</span></p>
|
||||
<script>
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var fec = parentEl.firstElementChild;
|
||||
assert_true(!!fec)
|
||||
assert_equals(fec.nodeType, 1)
|
||||
assert_equals(fec.getAttribute("id"), "first_element_child")
|
||||
})
|
||||
</script>
|
||||
22
tests/wpt/dom/Element-lastElementChild-svg.svg
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:h="http://www.w3.org/1999/xhtml"
|
||||
version="1.1"
|
||||
width="100%" height="100%" viewBox="0 0 400 400">
|
||||
<title>lastElementChild</title>
|
||||
<h:script src="/resources/testharness.js"/>
|
||||
<h:script src="/resources/testharnessreport.js"/>
|
||||
|
||||
<text x="200" y="40" font-size="25" fill="black" text-anchor="middle">Test of lastElementChild</text>
|
||||
<text id="parentEl" x="200" y="70" font-size="20" fill="black" text-anchor="middle">The result of <tspan id="first_element_child">this test</tspan> is <tspan id="last_element_child" font-weight="bold">not</tspan> known.</text>
|
||||
|
||||
<h:script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var lec = parentEl.lastElementChild;
|
||||
assert_true(!!lec)
|
||||
assert_equals(lec.nodeType, 1)
|
||||
assert_equals(lec.getAttribute("id"), "last_element_child")
|
||||
})
|
||||
]]></h:script>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 926 B |
22
tests/wpt/dom/Element-lastElementChild-xhtml.xhtml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>firstElementChild</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test of firstElementChild</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl">The result of <span id="first_element_child">this test</span> is <span id="last_element_child" style="font-weight:bold;">logged</span> above.</p>
|
||||
<script><![CDATA[
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var lec = parentEl.lastElementChild;
|
||||
assert_true(!!lec)
|
||||
assert_equals(lec.nodeType, 1)
|
||||
assert_equals(lec.getAttribute("id"), "last_element_child")
|
||||
})
|
||||
]]></script>
|
||||
</body>
|
||||
</html>
|
||||
17
tests/wpt/dom/Element-lastElementChild.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>lastElementChild</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<h1>Test of lastElementChild</h1>
|
||||
<div id="log"></div>
|
||||
<p id="parentEl">The result of <span id="first_element_child">this test</span> is <span id="last_element_child" style="font-weight:bold;">logged</span> above.</p>
|
||||
<script>
|
||||
test(function() {
|
||||
var parentEl = document.getElementById("parentEl");
|
||||
var lec = parentEl.lastElementChild;
|
||||
assert_true(!!lec)
|
||||
assert_equals(lec.nodeType, 1)
|
||||
assert_equals(lec.getAttribute("id"), "last_element_child")
|
||||
})
|
||||
</script>
|
||||