4 ms·
> The second one lets you trigger a state for the selected element, so you can see the styles applied when it’s active, hovered, on focus. If only that worked.
by Someone1234 9y ago
> The second one lets you trigger a state for the selected element, so you can see the styles applied when it’s active, hovered, on focus.
If only that worked. Sure, it sets the state from a CSS perspective, so you can test things like styles. But many popular JavaScript libraries simply ignore it (looking at you JQuery UI) because of how they hook those events.
For example I've seen many that set several attributes when you mouse over (e.g. data-x, additional class, etc), so if you want to test it the only way right now is to mouse over for real and then do this keyboard voodoo to cut the hovered element into the clipboard, and then after you move your mouse away paste it back onto the page.
You might say "Just call .trigger() from the console!" but the reality is there are several different ways to hook (particularly when a library supports both touch and mouse). Plus some intermingle the CSS hover selector AND Javascript events.