Closed Bug 500075 Opened 15 years ago Closed 15 years ago

:hover pseudo-class only applies to <embed> elements if completed by tag name

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jwkbugzilla, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(1 file)

Attached file Testcase
I noticed that "embed:hover" selector works while ":hover" or ".foo:hover" which should apply to the same element don't. This doesn't happen for other tags like images. See the attached testcase for an example - it contains almost identical <embed> and <img> tags and tries to style the text following them if the image is hovered. This doesn't work if the <embed> element is referenced by class name however.

Reproduced in Firefox 3.0.11 and current Minefield nightly.
Keywords: testcase
Yes, apparently it is. Does it mean that this behavior is intentional?
From nsCSSRuleProcessor.cpp:

// Return whether we should apply a "global" (i.e., universal-tag)
// selector for event states in quirks mode.  Note that
// |data.mIsLink| is checked separately by the caller, so we return
// false for |nsGkAtoms::a|, which here means a named anchor.
inline PRBool IsQuirkEventSensitive(nsIAtom *aContentTag)
{
  return PRBool ((nsGkAtoms::button == aContentTag) ||
                 (nsGkAtoms::img == aContentTag)    ||
                 (nsGkAtoms::input == aContentTag)  ||
                 (nsGkAtoms::label == aContentTag)  ||
                 (nsGkAtoms::select == aContentTag) ||
                 (nsGkAtoms::textarea == aContentTag));
}
Yes, found it myself already:

          // global selector (but don't check .class):
          !aSelector->mTag && !aSelector->mIDList && !aSelector->mAttrList &&
          // This (or the other way around) both make :not() asymmetric
          // in quirks mode (and it's hard to work around since we're
          // testing the current mNegations, not the first
          // (unnegated)). This at least makes it closer to the spec.
          !isNegated &&
          // important for |IsQuirkEventSensitive|:
          data.mIsHTMLContent && !data.mIsLink &&
          !IsQuirkEventSensitive(data.mContentTag)) {

Adding :not([non-existing-attribute]) works as work-around. WONTFIX?
Probably... although this is something we could change if we needed to and knew what was a good thing to change it to...

Given that you have a workaround, probably wontfix, yeah.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WONTFIX
(In reply to comment #4)
> Adding :not([non-existing-attribute]) works as workaround.

Should have tested in quirks mode :-(
[type]:hover is a workaround (requires guessing an existing attribute).
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: