brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: a DevTools live expression keeps a changing value pinned above the console

Devtools
~/tips/tip-devtools-live-expression

Console > Create Live Expression

Watch a value update by itself instead of typing it again and again.

Typing the same line into the console over and over to see whether a value changed is a chore. A live expression does the repeating for you.

Open the Console and click the eye icon:

Console > Create Live Expression

Type an expression and press Enter. Its result sits at the top of the console and refreshes every 250 milliseconds, while you click around in the page. My go to one for keyboard debugging:

document.activeElement

Now press Tab through a form and see where the focus really goes, including the moments it vanishes to body. Other good candidates are window.scrollY when a sticky header misbehaves, or the length of an array that should stop growing.

You can pin several at once and remove each with its close button. For a longer expression, Shift+Enter gives you a new line.

Because it runs several times a second, keep the expression read only. Something like items.pop() or a function that sends a request would run again on every refresh and wreck your test. Remove expressions you are done with, too, since they stay around the next time you open the console.

Further reading: Chrome DevTools: live expressions

More Devtools tips Clear site data for one site from Chrome DevTools user.id === 42 $x(path [, startNode]) @media (prefers-color-scheme: dark) { queryObjects(Promise) All Devtools tips (22) All topics

Link