mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
34 lines
781 B
HTML
34 lines
781 B
HTML
<ul id="birds">
|
|
<li>Orange-winged parrot</li>
|
|
<li class="endangered">Philippine eagle</li>
|
|
<li>Great white pelican</li>
|
|
</ul>
|
|
|
|
<script type="text/javascript">
|
|
|
|
console.error('element.matches.html');
|
|
|
|
var birds = document.getElementsByTagName('li');
|
|
var ch = false;
|
|
console.assert(birds.length === 3, '3');
|
|
|
|
for (var i = 0; i < birds.length; i++) {
|
|
if (birds.item(i).matches('.endangered')) {
|
|
console.assert(birds.item(i).innerHTML === 'Philippine eagle', birds.item(i).innerHTML);
|
|
ch = true;
|
|
}
|
|
}
|
|
console.assert(ch, 'was matched');
|
|
// birds = document.querySelectorAll('li');
|
|
|
|
ch = false;
|
|
// var counter = 0;
|
|
// birds.forEach(function(b) {
|
|
// counter++;
|
|
// });
|
|
// console.assert(counter === 3, 'Three');
|
|
|
|
console.exit(0);
|
|
|
|
</script>
|