JSFiddle - React, Tailwind, and code Playground

HTML

<table id="profile-data"><tr><td>selector type</td><td>total ms</td><td>average ms</td></tr></table>
<div class="navbar" align="center"><a accesskey="p" href="copyright-notice.html">previous</a> &nbsp; <a accesskey="n" href="idl-definitions.html">next</a> &nbsp; <a accesskey="c" href="Overview.html#contents">contents</a> &nbsp; <a accesskey="i" href="def-index.html">index</a> 

<hr title="Navigation area separator">
</div>

<div class="noprint" style="text-align: right">
<p style="font-family: monospace;font-size:small">13 November,
2000</p>
</div>

<div class="div1"><a class="selectMe" id="Events" name="Events"></a> 

<h1 id="Events-h1" class="div1">1. Document Object Model
Events</h1>

<dl>
<dt><i>Editors</i></dt>

<dd>Tom Pixley, Netscape Communications Corp.</dd>
</dl>

<div class="noprint">
<h2 class="selectMe" id="table-of-contents">Table of contents</h2>

<ul class="toc">
<li class="tocline3"><a class="tocxref" href="#Events-overview">1.1. Overview of the DOM Level 2 Event
Model</a> 

<ul class="toc">
<li class="tocline4"><a class="tocxref" href="#Events-overview-terminology">1.1.1. Terminology</a></li>
</ul>
</li>

<li class="tocline3"><a class="tocxref" href="#Events-flow">1.2.
Description of event flow</a> 

<ul class="toc">
<li class="tocline4"><a class="tocxref" href="#Events-flow-basic">1.2.1. Basic event flow</a></li>

<li class="tocline4"><a class="tocxref" href="#Events-flow-capture">1.2.2. Event capture</a></li>

<li class="tocline4"><a class="tocxref" href="#Events-flow-bubbling">1.2.3. Event bubbling</a></li>

<li class="tocline4"><a class="tocxref" href="#Events-flow-cancelation">1.2.4. Event cancelation</a></li>
</ul>
</li>

<li class="tocline3"><a class="tocxref" href="#Events-registration">1.3. Event listener registration</a> 

<ul class="toc">
<li class="tocline4"><a class="tocxref" href="#Events-Registration-interfaces">1.3.1. Event registration
interfaces</a> 

<ul>
<li class="tocline5"><a href="#Events-EventTarget">EventTarget</a>,
<a...

CSS

#profile-data {
    font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif;
    font-size: 13px;
}
#profile-data {
    display: none;    
    width: 100%;
    margin: 5px 0 50px 0;    
}
#profile-data td {
    padding: 3px;
}
#profile-data tr:nth-child(1) td {
    background-color: #CCC;
}
#profile-data tr td:not(:nth-child(1)) {
    text-align: right;
}

JavaScript

function profile(fn, type, times) {
    var totalTime = 0, start, end;
    
    for(var i = 0; i < times; i++) {
        start = new Date().getTime();
        fn();
        end = new Date().getTime();
        totalTime += (end - start);
    }
    
    return { "type": type, "average": (totalTime/times), "total": totalTime };
}

function withID() {
    var ids = "#Events, #table-of-contents, #Events-overview, #Events-flow-capture, #Events-EventTarget, #Events-EventListener";
    
    var results = $(ids);
}

function withUnchainedIDs() {
    var results = $("#Events").add("#table-of-contents").add("#Events-overview").add("#Events-flow-capture").add("#Events-EventTarget").add("#Events-EventListener");
}

function withClass() {
    var classSelector = ".selectMe";
    
    var results = $(classSelector);
}

function executeTests(times) {
    var tests = [
        { name: "combined ID selectors", fn: withID },
        { name: "disjoint ID selectors", fn: withUnchainedIDs },
        { name: "class selector", fn: withClass }
    ];
    
    var results = [];
    
    /** 
     * Number of times each method should be run
     */
    var test;
    for(var i = 0; i < tests.length; i++) {
        test = tests[i];
        results.push(profile(test.fn, test.name, times));
    }

    return results;
}


function displayResults(results, times) {
    var table = $("#profile-data");
    $.each(results, function(index, result) {
        var row = $("<tr></tr>");
        row.append($("<td></td>").text(result.type));
        row.append($("<td></td>").text(result.total));
        row.append($("<td></td>").text(result.average));
        table.append(row);
    });

    var summary = "Ran each test " + times + " times.";
    $("#profile-data").before($("<div></div>").text(summary));
    $("#profile-data").show();
}

$(function() {
    var times = 10000;
    var results = executeTests(times);
    displayResults(results, times);
});