Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Live Expressions in Safari Debugger

Is there a way to do Live Expressions in the Safari Debugger? I need to do exactly what is explained in this article, but in Safari.

https://developer.chrome.com/docs/devtools/accessibility/focus/

I know about Safari's watch expressions, but those don't seem to update as I interact with the DOM and clicking the refresh button on the watch expression takes away the focus from DOM elements.

like image 830
seansan Avatar asked Sep 05 '25 03:09

seansan


1 Answers

I was looking for the same thing, this workaround was good enough for my use case. In the Safari console:

window.intv = setInterval(() => {
  if (window.curEl !== document.activeElement) {
    window.curEl = document.activeElement;
    console.log(document.activeElement);
  }
}, 100);

// when you're done
clearInterval(window.intv);
like image 122
James Irwin Avatar answered Sep 09 '25 07:09

James Irwin