mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
26 lines
536 B
HTML
26 lines
536 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 closes2 = element.closest("div.container");
|
|
|
|
console.error('element.closest.html');
|
|
console.assert(closes2 != null, 'not null');
|
|
|
|
closes2 = element.closest("p.test");
|
|
console.assert(closes2 === null, 'NULL');
|
|
|
|
console.exit();
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|