Closed Bug 96984 Opened 25 years ago Closed 24 years ago

:hover pseudo-class, on other than link, not applied unless type selector included.

Categories

(Core :: CSS Parsing and Computation, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla1.1alpha

People

(Reporter: val, Assigned: dbaron)

References

Details

(Keywords: testcase)

Attachments

(3 files)

From Bugzilla Helper: User-Agent: Mozilla/4.6 [en-gb]C-CCK-MCD NetscapeOnline.co.uk (Win98; I) BuildID: 2001080110 If a :hover pseudo-class selector is used on an element other than a link, then a Class or Id selector is not sufficient for the selector to be applied - the Type selector is also required. So, for example, '.special:hover' won't work with a DIV with 'class="special"', but 'div.special:hover' will. The link pseudo-classes (:link & :visited) obviously refer to A elements, and the CSS Recommendation provides an example of simply a Class selector with a link pseudo-class. It's true that the only examples for the :hover, :active & :focus pseudo-classes include a Type selector i.e. A. But given that a Class or Id selector is usually sufficient without a Type selector then, for a specific pseudo-element such as :hover, it is surely inconsistent to require a Type selector for all elements except A. Reproducible: Always Steps to Reproduce: The attached testcase illustrates this situation.
hmm... looks like a dupe of bug 5693 Just about every angle has been considered for :hover. :-) *** This bug has been marked as a duplicate of 5693 ***
Status: UNCONFIRMED → RESOLVED
Closed: 25 years ago
Resolution: --- → DUPLICATE
David: not conviced this is a dup of bug 5693, since that one is very complex. Please verify this yourself. (Testcase observed on Linux, marking all/all.)
OS: Windows 98 → All
Hardware: PC → All
I think that was intentionally done as a performance hack because we performed really badly on W3C pages. Once we fix hierarchical :hover and fix the performance problems hopefully we can remove this hack. Reopening, marking future, and adding dependency to bug 5693.
Status: RESOLVED → UNCONFIRMED
Depends on: 5693
Resolution: DUPLICATE → ---
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P2
Target Milestone: --- → Future
Keywords: testcase
*** Bug 93602 has been marked as a duplicate of this bug. ***
Bug 75559 is about the performance problems.
Depends on: 75559
I think this could be fixed now after the changes I made for bug 5693, so targetting at 1.1beta. Note the comment in nsCSSStyleSheet.cpp: // ALSO NOTE: we used to do this only in Quirks mode, but because of // performance problems we do it all the time now (bug 68821) // When style resolution due to state changes is optimized this // should go back to QuirksMode only behavour (see also bug 75559)
Target Milestone: Future → mozilla1.1beta
Target Milestone: mozilla1.1beta → mozilla1.1alpha
Attached patch patch — — Splinter Review
I tested, and there are no performance problems on http://www.w3.org/ . The changes in bug 5693 made :hover hierarchical and they made it so that HasStateDependentStyle is event-specific. The latter change means that the performance problems happening when moving the mouse (for which this was done) can only occur for :hover selectors (not :active, as happened on http://www.w3.org/), and the former change means that it won't happen for :hover since the root node won't constantly go in and out of :hover, but will rather always be in :hover. Thus this patch limits the quirk to quirks mode, to selectors that have no ID, class, tag, or attribute selectors (on the same simple selector), and to the :hover and :active selectors (and no longer to :focus). It should be :hover only once we make :active work correctly (see bug 65917).
And, er, why do we have that quirk again?
Attachment #83342 - Flags: superreview+
Comment on attachment 83342 [details] [diff] [review] patch Thank your for removing that awful hack I put in! sr=attinasi
We have the quirk so people who put ":hover" in their stylesheets don't get behavior that's too unexpected. Do you think we should remove that? I expect we'd get a bunch of bug reports if we did, but I could be wrong...
So.. with this patch in quirks mode we apply :hover and :active to: 1) Links 2) <button>, <img>, <input>, <label>, <select>, <textarea> I suspect the reason the form controls were in the list was because the list was being used for :focus as well as :hover/:active... I can see applying :active to buttons in quirks, I guess.... Other than that, I don't really see a reason to apply :hover/:active to these elements but no others in quirks mode, other than backwards compat with ourselves. Not sure what the deal with <img> is. Why was <li> in the list (and why was it removed)?
As a quirk, it could be just for links, but authors might want to use styles on form controls. Furthermore, we don't want to break our own UA.css styles. I'm considering removing the quirk completely, but I'd want (1) bug 65917 to be fixed first and (2) not to do it the day before a milestone closure. So I'd rather not make the quirk more quirky than it was before (so perhaps I should undo the mIsHTMLLink / nsHTMLAtoms::a switch). I have no idea why li was there -- it was probably some sort of typo, and it didn't make any sense to me, so I removed it.
Comment on attachment 83342 [details] [diff] [review] patch ah, right. I forgot that html.css uses this stuff... r=bzbarsky
Attachment #83342 - Flags: review+
Fix checked in 2002-05-18 19:05 PDT.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago → 24 years ago
Resolution: --- → FIXED
*** Bug 161547 has been marked as a duplicate of this bug. ***
*** Bug 179611 has been marked as a duplicate of this bug. ***
verified
Status: RESOLVED → VERIFIED
Attached file Test case —
I attached a test case showing that the bug still exists in Mozilla 1.4 and 1.5. If the element (for example P or TD) is not specified, hover does not work. Thanks for reopening this issue.
Patrick, the testcase you attached is in quirks mode, where the bug was purposefully left in. See http://www.mozilla.org/docs/web-developer/quirks/quirklist.html the last item under "Miscellaneous & Style". Unfortunately, far too many pages out there heavily rely on the buggy quirks mode behavior.
*** Bug 297950 has been marked as a duplicate of this bug. ***
Is that patch there still any good? Needs approval if so.
When was this patch checked in?
Sorry, nvm. bug 297950 was duped against this originally, which ended up confusing me.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: