mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
31 lines
613 B
HTML
31 lines
613 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<body>
|
|
<p class="a">Class a.</p>
|
|
<p class="b">Class b.</p>
|
|
<p id="start">
|
|
<b class="a">This a class.</b>
|
|
<b class="b">This b class.</b>
|
|
</p>
|
|
|
|
<script>
|
|
function myFunction() {
|
|
var el = document.getElementById('start');
|
|
var x = el.querySelectorAll('.nonexistent');
|
|
console.assert(x.length === 0, 'nonexistent element');
|
|
|
|
var y = el.querySelectorAll('.b');
|
|
console.assert(y.length === 1, 'b class b.');
|
|
|
|
console.assert(y.item(0).innerText === 'This b class.', 'b class');
|
|
|
|
}
|
|
|
|
console.error('element.querySelectorAll.html');
|
|
myFunction();
|
|
console.exit();
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|