within-element
Version:
check if an element is within the element
29 lines (26 loc) • 658 B
HTML
<html>
<head>
<title>within-element test</title>
</head>
<body>
<div id="a">
here is some text inside "a"
<div id="c">
here is some text inside "c"
</div>
</div>
<div id="b">
here is some text inside "b"
</div>
<script src="build/build.js"></script>
<script>
var within = require('within-element');
var a = document.getElementById('a');
var b = document.getElementById('b');
var c = document.getElementById('c');
console.log('should be false:', within(b, a));
console.log('should be true:', within(c, a));
</script>
</body>
</html>