mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
[assert] document.body.children
This commit is contained in:
parent
1435c2da92
commit
da14bf16cd
30
test/ecmascript/assert/document.body.children.html
Normal file
30
test/ecmascript/assert/document.body.children.html
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>Click the button to get the tag names of the body element's children.</p>
|
||||||
|
|
||||||
|
<button onclick="myFunction()">Try it</button>
|
||||||
|
|
||||||
|
<p id="demo"></p>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function myFunction() {
|
||||||
|
var c = document.body.children;
|
||||||
|
var txt = "";
|
||||||
|
var i;
|
||||||
|
for (i = 0; i < c.length; i++) {
|
||||||
|
txt = txt + c[i].tagName + "<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
console.assert(txt === '#text<br>P<br>#text<br>BUTTON<br>#text<br>P<br>#text<br>SCRIPT<br>#text<br>#text<br>', txt);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error('document.body.children');
|
||||||
|
myFunction();
|
||||||
|
console.exit(0);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user