1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00
elinks/test/ecmascript/assert/element.closest.html
2024-05-05 21:52:07 +02:00

26 lines
679 B
HTML

<!DOCTYPE html>
<html>
<body>
<div class="demo container"> Grandparent
<div class="demo container">Parent
<div id="myElement" class="demo">The outer HTML of closest element will be shown.</div>
</div>
</div>
<script>
var element = document.getElementById("myElement");
var closest = element.closest("div.container");
console.error('element.closest.html');
console.assert(closest.outerHTML === '<DIV class="demo container">Parent\n <DIV id="myElement" class="demo">The outer HTML of closest element will be shown.</DIV>\n </DIV>', 'TODO');
closest = element.closest("p.test");
console.assert(closest === null, 'NULL');
console.exit(1);
</script>
</body>
</html>