1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00
elinks/test/ecmascript/matches.html
Witold Filipczyk 17a68b0cfd [quickjs] element.matches
Also change querySelector and querySelectorAll.
They search from current node, not root.
2021-11-27 19:27:30 +01:00

16 lines
387 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">
var birds = document.getElementsByTagName('li');
for (var i = 0; i < birds.length; i++) {
if (birds[i].matches('.endangered')) {
alert('The ' + birds[i].textContent + ' is endangered!');
}
}
</script>