1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-20 01:46:15 -04:00
elinks/test/ecmascript/assert/element.matches.html
2024-05-05 19:54:12 +02:00

25 lines
535 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');
var birds = document.getElementsByTagName('li');
var ch = false;
for (var i = 0; i < birds.length; i++) {
if (birds[i].matches('.endangered')) {
console.assert(birds[i].innerHTML === 'Philippine eagle', birds[i].innerHTML);
ch = true;
}
}
console.assert(ch, 'was matched');
console.exit(0);
</script>