Anonymous children of textarea are exposed to user stylesheet

NEW
Unassigned

Status

()

Core
CSS Parsing and Computation
13 years ago
11 years ago

People

(Reporter: Matt, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20051218 Firefox/1.6a1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20051218 Firefox/1.6a1

Let's say for instance I use this code in my userContent.css:
* { font-family: sans-serif !important; }
textarea, pre, code, samp, kbd, .pre, .pr, .code { font-size: small !important; font-family: monospace !important; }

One would expect that all the elements in the second line would use monospace, but textarea's seem to think otherwise.  I even tried scattering the line "textarea { font-family: monospace !important; }" around my userContent.css, but for some damned reason, Gecko will NOT use monospace on textarea's.

This is mainly due to my desire to disable custom fonts, but for some other damned reason, this "feature" simply applies your default serif font family to everything rather than smartly handling different situations.  In that case, I'd like to see that all items that have the "sans-serif" font family as a choice (or from a small list of common sans-serif fonts) to be renderred using the browser's sans-serif; render all cases of a monospace font-family using monospace; and render everything else using the user's serif font-family.  I can make a separate bug for that, but I thought it was worth mentioning here as that might have something to do with this bug.

Reproducible: Always

Steps to Reproduce:
1. Use those two lines in your userContent.css
2. Restart
3. Viola!

Actual Results:  
Nearly everything is renderred using serif instead of using monospace for the elements specified.

Expected Results:  
Gecko uses the !important's the way it frickin' should.

Comment 1

13 years ago
Maybe related to bug 157255 comment 5?

Comment 2

13 years ago
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8) Gecko/20051108 Firefox/1.5

Testing using Stylish (http://forums.mozillazine.org/viewtopic.php?t=327735) revealed that an anonymous child of the textarea was exposed to the user stylesheet.  Your first rule (with the selector "*") is applied to that child, and of course the font chosen there overrides the font chosen for its parent (the textarea).  You should be able to workaround this oddness by changing your second selector from "textarea" to "textarea, textarea *".

I think this is a bug, unless there's a good reason for anonymous children of textareas (an implementation detail) to be exposed to selectors in user stylesheets.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Hardware: PC → All
Summary: Cannot override style in textarea via !important → Anonymous children of textarea are exposed to user stylesheet

Comment 3

13 years ago
A simpler way to test is to put the following in your user stylesheet:

textarea * { color: blue ! important; }

It causes textarea text to be blue, which I think is wrong.
(Reporter)

Comment 4

13 years ago
Well, the DOM2 spec doesn't say that textarea is supposed to have an anonymous child node or anything <http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-24874179>, and the DOM Inspector doesn't appear to catch some sort of anonymous node, so this definitely is something odd with CSS.
We all agree it's a bug; please stop arguing.
(The reason I didn't comment initially is that I thought it was already filed, but I couldn't find it.)
Assignee: dbaron → nobody
QA Contact: ian → style-system
You need to log in before you can comment on or make changes to this bug.