HTML Preparation code:
AخA
 
1
<div id="wrap">
2
    <div class="hello class2" id="hello2" data-src="weqwesad">Hello</div>
3
    <img src="" width="500" height="600" class="hello class3" id="hello3" data-src="wedqwesd">
4
    <div class="hello class4" id="hello4" data-src="weqwecsd">Hello</div>
5
    <img src="" width="500" height="600" class="hello class5" id="hello5" data-src="wexqwesd">
6
    <div class="hello class6" id="hello6" data-src="weqwvesd">Hello</div>
7
    <img src="" width="500" height="600" class="hello class7" id="hello7" data-src="weqwzesd">
8
    <div class="hello class8" id="hello8" data-src="wevqwesd">Hello</div>
9
    <img src="" width="500" height="600" class="hello class9" id="hello9" data-src="weqwbesd">
10
    <div class="hello class10" id="hello10" data-src="weqcwesd">Hello</div>
11
    <img src="" width="500" height="600" class="hello class11" id="hello11" data-src="weqzwesd">
12
    <div class="hello class12" id="hello12" data-src="weqswesd">Hello</div>
13
    <img src="" width="500" height="600" class="hello class13" id="hello13" data-src="wgeqwesd">
14
    <div class="hello class14" id="hello14" data-src="weqwhesd">Hello</div>
15
    <img src="" width="500" height="600" class="hello class15" id="hello15" data-src="weqwvesd">
16
</div>
Tests:
  • data attribute plain

     
    document.getElementById('wrap').querySelector('[data-src]');
  • data attribute div

     
    document.getElementById('wrap').querySelector('div[data-src]');
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    data attribute plain
    data attribute div

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36
Chrome 83 on Windows
View result in a separate tab
Test name Executions per second
data attribute plain 1824606.8 Ops/sec
data attribute div 1757576.9 Ops/sec