Closed
Bug 339946
Opened 18 years ago
Closed 18 years ago
:hover style overridden by javascript changes to non-hover style
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: ggb.mzl, Unassigned)
Details
Attachments
(1 file)
2.26 KB,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3 If an HTML document contains a :hover style to change the background colour of an element when the mouse overs over the element (I would guess it applies to other style properties as well, but I have only tested it with the background colour), and then a javascript function changes the ordinary background colour of the same element, the hover style property is ignored. I have written a minimal HTML document to demonstrate the point. Reproducible: Always Steps to Reproduce: 1) Open the HTML document. 2) Pass the mouse over the two rows in the document and observe how the foreground and background colours of the rows change. 3) Click on the check box – this will invoke a javascript function that will change the colour of the two rows. The background colour of the first row is changed to magenta, and the second row is changed to transparent. 4) Now move the mouse over the two rows. You will observe that the text colour continues to respond to the hover style (the text colour was not changed by the javascript), but the background colour no longer responds to the hover style.
Reporter | ||
Comment 1•18 years ago
|
||
Comment 2•18 years ago
|
||
Yes that's right. Javascript set styles are set in the elements style attribute, which generally takes priority over stylesheet rules. http://www.w3.org/TR/CSS21/cascade.html#specificity
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 3•18 years ago
|
||
Apologies – you are right. I had thought of the pseudo elements as discrete and separate selectors, and had not looked at whether they might be legitimately overridden by higher precedence selectors that omit the pseudo-element.
You need to log in
before you can comment on or make changes to this bug.
Description
•