matchesSelector

Benchmark created by Jakub on


Preparation HTML

<div id='a'>
<div class='b'></div>
</div>
<script>
  var a = document.getElementById('a').getElementsByTagName('div')[0];
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
matchesSelector
a.webkitMatchesSelector('.b');
ready
classList
a.classList.contains('b');
ready
comlex
a.webkitMatchesSelector('div .b');
ready
complex
a.parentNode.tagName == 'DIV' && a.classList.contains('b');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.