mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[assert] document.querySelector
This commit is contained in:
parent
f2fbde2de7
commit
be67094940
22
test/ecmascript/assert/document.querySelector.html
Normal file
22
test/ecmascript/assert/document.querySelector.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<p class="a">Class a.</p>
|
||||||
|
<p class="b">Class b.</p>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function myFunction() {
|
||||||
|
var x = document.querySelector('.nonexistent');
|
||||||
|
console.assert(x === null, 'nonexistent element');
|
||||||
|
|
||||||
|
var y = document.querySelector('.b');
|
||||||
|
console.assert(!(y === null), 'Class b');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error('document.querySelector.html');
|
||||||
|
myFunction();
|
||||||
|
console.exit(0);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user