Closed Bug 90146 Opened 23 years ago Closed 23 years ago

:hover not behaving as expected in standards mode

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 5693

People

(Reporter: lordpixel, Assigned: pierre)

Details

Have a look at this testcase (I'm using Moz 0_9_2 which is 2001062815)

http://bugzilla.mozilla.org/showattachment.cgi?attach_id=37800

That example doesn't specify a doctype, and Hixie says that the W3C working
group hasn't come to a final decision whether the fact the :hover doesn't
activate on the second image is a bug or not.

However, he went on to say that while the presentation given above is acceptable
for quirks mode, in standards mode Mozilla should show the :hover effect for
both images. It doesn't. Adding the doctype which triggers standards mode has no
effect (if people really want me to I'll add a second case to demonstrate).

I'd have to concur - the :hover not working because the <img> is inside an <a>
is extremely counter-intuitive. Hixie - I'm curious as to why this should depend
on which mode we're in to be honest...

(Just to ask everyone to politely to stop and think before acting: don't just
dup this onto the heirarchical hover bug unless you can argue convincingly that
its the same issue - this is the other way around - the style is defined on the
inner element not the outer one!)

For a workaround (found in another bug), write instead:

:hover > img { border: thick solid red }
:hover > img { border: thick solid blue }

Ommit the > if you need it to work in IE5. This to my mind just underscores how
inconsistent all this is. Even though I acknowledge that "img:hover" and ":hover
> img" are two completely different things, common sense (IMHO ;-P) would
dictate both should match in the given example.
The testcase above comes from bug 52766.


*** This bug has been marked as a duplicate of 5693 ***
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.