Closed Bug 282457 Opened 20 years ago Closed 20 years ago

CSS styles for PRE inside CODE apparently ignored

Categories

(Core :: DOM: HTML Parser, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: christopher.webster, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 The example source attempts to provide a CSS style for PRE inside CODE which specifies that colour should be red. In fact the text displays in black in this version of Mozilla and in at least one release each of Mozilla 1.5 and 1.4. The text displays as expected in Microsoft Internet Exploder 6.0.2800.1106. Colour is not the only style property lost in this construction: I discovered the problem when attempting to specify font-family and font-size in a much larger and more complex web page. If the style is specifed just for PRE instead of for CODE PRE, the text displays as expected. Reproducible: Always Steps to Reproduce: 1. Using Mozlla, view the supplied sample URL, or any file with this source code: <html> <head></head> <style type=text/css> code pre { color: red } </style> <body> <p> <code><pre>I think this should display in red</pre></code> </p> </body> </html> 2. er .... 3. That's it. Actual Results: The browser displayed "I think this should display in red" in black. Expected Results: It should, according to my understanding of the CSS rules, display it in red.
Assignee: jag → parser
Component: XP Apps → HTML: Parser
Product: Mozilla Application Suite → Core
QA Contact: mrbkap
Version: unspecified → Trunk
<code> can not contain <pre>, and mozilla's html parser enforces that. thus, in the DOM tree, <pre> is not a child of the <code>, so the CSS rule does not apply. see http://www.w3.org/TR/html4/struct/text.html#h-9.2.1 - code can only contain %inline; i.e: <!ENTITY % fontstyle "TT | I | B | BIG | SMALL"> <!ENTITY % phrase "EM | STRONG | DFN | CODE | SAMP | KBD | VAR | CITE | ABBR | ACRONYM" > <!ENTITY % special "A | IMG | OBJECT | BR | SCRIPT | MAP | Q | SUB | SUP | SPAN | BDO"> <!ENTITY % formctrl "INPUT | SELECT | TEXTAREA | LABEL | BUTTON">
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Thank you for the swift clarification. My apologies for the false alarm.
You need to log in before you can comment on or make changes to this bug.