tagName vs matches

Benchmark created on


Preparation HTML

<a href="foo">foo</a>

Setup

const selector = "a[href]";
const tagName = "a";
const element = document.querySelector("a");

Test runner

Ready to run.

Testing in
TestOps/sec
matches
element.matches(selector);
ready
tagname
element.tagName.toLowerCase() === tagName;
ready

Revisions

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