Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
nolanlawson / index.html
Created October 21, 2022 22:30
Sibling selector benchmark
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sibling selector benchmark</title>
</head>
<body>
<pre id="display"></pre>
<div id="container"></div>
<script type="module">
@nolanlawson
nolanlawson / .gitignore
Last active October 16, 2022 02:21
exit-hook repro 3.1.0
node_modules
@nolanlawson
nolanlawson / index.html
Last active October 13, 2022 21:01
Unread indicator
<!doctype html>
<html>
<head>
<title>Tab title</title>
</head>
<body>
<h1>Unread indicator – load, pin and wait 10 seconds</h1>
<script type=module>
let count = 0
const title = document.title
@nolanlawson
nolanlawson / index.html
Last active October 13, 2022 18:00
aria-label on a <slot>
<!doctype html>
<html>
<head>
<style>
button {
width: 200px;
height: 50px;
}
</style>
<head>
@nolanlawson
nolanlawson / .gitignore
Last active September 26, 2023 12:27
Chrome style concatenation benchmark
node_modules
results.json
@nolanlawson
nolanlawson / chrome.results.json
Last active October 8, 2022 16:40
Raw data - updated selector benchmark
{
"benchmarks": [
{
"name": "Scoping - classes - RHS",
"bytesSent": 0,
"measurement": {
"name": "total",
"mode": "performance",
"entryName": "total"
},
@nolanlawson
nolanlawson / index.html
Created August 27, 2022 15:55
Layout thrashing browser optimization demo
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css"
integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/css/bootstrap.min.css"
integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/css/bootstrap-theme.min.css"
integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
@nolanlawson
nolanlawson / .gitignore
Created August 25, 2022 21:01
Repro another tachometer issue
node_modules
@nolanlawson
nolanlawson / index.html
Last active August 6, 2022 22:59
Layout thrashing demo
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css"
integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/css/bootstrap.min.css"
integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/css/bootstrap-theme.min.css"
integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
@nolanlawson
nolanlawson / extends.js
Created August 4, 2022 19:16
Detecting customelements define extends
// Via https://github.com/ungap/custom-elements/blob/bdb7c27/index.js#L428-L456
const SUPPORTS_EXTENDING_BUILT_IN_ELEMENTS = (() => {
const tagName = `extends-li-${Math.floor(Math.random() * 1000000)}`;
self.customElements.define(tagName, class extends HTMLLIElement {}, { extends: 'li' });
const elm = document.createElement('li', { is: tagName });
return elm.outerHTML.indexOf(tagName) !== -1;
})();