Skip to content

Instantly share code, notes, and snippets.

@Fasteroid
Last active April 30, 2026 15:51
Show Gist options
  • Select an option

  • Save Fasteroid/b10a7bd7b9591f39593a600b71a61aa2 to your computer and use it in GitHub Desktop.

Select an option

Save Fasteroid/b10a7bd7b9591f39593a600b71a61aa2 to your computer and use it in GitHub Desktop.
created to stealthily inspect an css issue where the devtools overlays alone were enough to perturb it
let lastX = 0;
let lastY = 0;
let sameClicks = 0;
document.addEventListener('click', (e) => {
if( !e.ctrlKey ) return;
if( lastX == e.x && lastY == e.y ){
sameClicks++;
}
else {
sameClicks = 0;
}
lastX = e.x;
lastY = e.y;
let target = e.target;
for (let i = 0; i < sameClicks; i++) {
target = target?.parentElement;
}
console.log(
target,
{
rect: target.getBoundingClientRect(),
style: getComputedStyle(target)
}
)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment