Skip to content

Instantly share code, notes, and snippets.

// HTML
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<div id="example2-visualization" style="width: 600px; height: 360px; padding: 10px;"></div>
<button id="example2-b1">Toon 21e eeuw</button>
// JavaScript
google.charts.load('current', {packages:['corechart']});
google.charts.setOnLoadCallback(init);
function init() {
@aaronpeters
aaronpeters / cdnfinder-js-vs-nojs-mobile-inp-durations.md
Last active December 18, 2023 07:50
CDN Finder - JS vs No JS page - duration of worst INPs where element is form input field

Mobile only. CrUX data shows INP is not Good on CDN Finder page, p75 is ~ 400 ms.

Page with JS is the page in production, https://www.cdnplanet.com/tools/cdnfinder/

I'm tracking worst INP with web vitals lib (with attribution).

Data shows INP is much higher for interactions with the form input field compared to clicking on the pink button. I've spent quite some time debugging (incl. turning off Google Analytics) and I don't understand the high INP. My analyis/debugging shows keydown and keyup is not the culprit, those interactions have low INP.

@aaronpeters
aaronpeters / cdnfinder-nojs-mobile-beacon.json
Created December 15, 2023 13:06
CDN Finder No JS on mobile beacon (Aaron's phone)
{
"context": {
"clientIp": "109.37.139.0",
"country": "NL",
"deviceMemory": 4,
"mobile": "?1",
"platform": "\"Android\"",
"ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Microsoft Edge\";v=\"120\""
},
"duration": 408,
@aaronpeters
aaronpeters / rv-inp-beacon.json
Created December 12, 2023 08:29
RV beacon voor INP
{
"domain_tag": "953B05AE1D",
"domain_string": "hollandsnieuwe.nl",
"url_string": "/",
"url_uuid": "1f8514f2-1450-447e-9186-a9702d736613",
"session_id": "2d9063ca-6234-4f10-87a1-62ecaa3a51fc",
"request_id": "2ce17f35-4501-48cf-a7a3-fe963d2f955f",
"inserts": [
{
"type": "request",
@aaronpeters
aaronpeters / highlight-worstInp-on-page-from-console.js
Last active December 5, 2023 10:01
Highlight worst INP on page from console
// Paste code below in console after page load and
// before interacting with page
const getName = (node) => {
const name = node.nodeName;
return node.nodeType === 1
? name.toLowerCase()
: name.toUpperCase().replace(/^#/, '');
};
@aaronpeters
aaronpeters / example-topElement.json
Created December 1, 2023 16:14
Example INP Top Element JSON
{
"count": 254,
"inp": {
"bins": {
"good": 86,
"moderate": 92,
"poor": 76
},
"percentiles": {
"p25": 176,
@aaronpeters
aaronpeters / loaf-noam-script-output-cdnfinder-nov08.json
Created November 8, 2023 10:09
LoAF Noam's script output CDN Finder Nov 8
[
{
"loaf_blocking_duration": 5,
"event_duration": 152,
"longest_script": {
"name": "TimerHandler:setTimeout",
"entryType": "script",
"startTime": 93865.89999997616,
"duration": 48,
"type": "user-callback",
@aaronpeters
aaronpeters / loaf-entries-cdnfinder-nov08.json
Created November 8, 2023 09:56
LoAF entries CDN Finder Nov 8
[
{
"name": "long-animation-frame",
"entryType": "long-animation-frame",
"startTime": 29.5,
"duration": 646,
"renderStart": 611.1999999880791,
"styleAndLayoutStart": 652.5,
"desiredRenderStart": 604,
"firstUIEventTimestamp": 0,
@aaronpeters
aaronpeters / loaf-example.json
Created November 7, 2023 14:45
LoAF API entry example
{
"name": "long-animation-frame",
"entryType": "long-animation-frame",
"startTime": 84.90000000596046,
"duration": 545,
"renderStart": 613.5999999940395,
"styleAndLayoutStart": 613.5999999940395,
"desiredRenderStart": 456.90000000596046,
"firstUIEventTimestamp": 0,
"blockingDuration": 306,
@aaronpeters
aaronpeters / energievergelijker-toggle-filters.js
Created September 27, 2023 08:02
Energievergelijker show/hide de filters, met vanilla JS
// Geef de HTML elementen een id
const vulVerbruikIn = document.querySelector('#vulVerbruikIn')
const sluitFiltersKruisje = document.querySelector('#sluitFiltersKruisje')
const sluitFiltersToonResultaten = document.querySelector('#sluitFiltersToonResultaten')
// Add/remove een CSS class op elementen om de show/hide van filters te doen
function showHideFilters() {
document.querySelector('#filters').classList.toggle('de-nieuwe-class')
// TODO: verander met .classList.toggle ook de CSS van andere element(en) om die slide in/out animatie te doen
}