0

I'm building something to show elements in these different states and it's making me curious.

Is there some simple way to trigger these?

Are they rewriting the selectors / classlists under the hood? This can work but you'd need to do it for every child as well and seems really error prone and messy.

Bill Criswell
  • 32,161
  • 7
  • 75
  • 66
  • Does this answer your question? [See :hover state in Chrome Developer Tools](https://stackoverflow.com/questions/4515124/see-hover-state-in-chrome-developer-tools) ------------ ***Answer: https://stackoverflow.com/a/27623294/11171286*** – Manas Khandelwal Mar 27 '21 at 21:35
  • No. I'm asking how devtools simulates the `:hover` state in the CSS. That answer simulates the event to get the JS event to happen. – Bill Criswell Mar 27 '21 at 21:49
  • The more I read around the less I feel like it's possible. It seems like everyone else trying to accomplish this needs to rewrite this styles. – Bill Criswell Mar 28 '21 at 00:01
  • 2
    Devtools is using the internal CDP command [CSS.forcePseudoState](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-forcePseudoState). You can inspect the [source code](https://source.chromium.org/chromium). – wOxxOm Mar 28 '21 at 04:27
  • Thank you wOxxOm! The exact answer I was looking for. I’ll read up on this a bit. – Bill Criswell Mar 28 '21 at 10:23

0 Answers0