Dom操作-元素查找

Benchmark created on


Preparation HTML

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="content" >
    <div id="text1">Hello World</div>
    <div id="text2">Hello JavaScript</div>
  </div>
</body>
</html>

Test runner

Ready to run.

Testing in
TestOps/sec
getElementById
const content = document.getElementById('content')
ready
querySelector
const content = document.querySelector('#content')
ready

Revisions

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