Closed
Bug 1682207
Opened 3 years ago
Closed 3 years ago
Element.matches(":hover") returns false even when element is hovered
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
INVALID
People
(Reporter: Jamie, Unassigned)
References
Details
STR:
- Open this:
data:text/html,<div id="div"><button id="button">text
- Move the mouse over the button.
- Open the web console with the keyboard (e.g. control+shift+k on Windows). Do not move the mouse.
- Enter this:
div.matches(":hover")
- Expected: true
- Actual: false
- Enter this:
button.matches(":hover")
- Expected: true
- Actual: false
- Enter this:
div.matches("div:hover")
- Correct result: true
- Enter this:
button.matches("button:hover")
- Correct result: true
Discovered while working on bug 494175; see Phabricator comment. However, I might be misunderstanding something here, so marking as unconfirmed. Also, Gijs noted he couldn't reproduce this:
it works for me when testing with
setInterval(() => console.log(window.document.documentElement.matches(":hover")), 500)
in the browser console and hovering the toolbar vs not hovering it.
Comment 1•3 years ago
|
||
Works the same in other browsers. You should not use quirks mode ;)
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•