CSS generated content does not work on replaced elements (img, form controls, etc.)

VERIFIED INVALID

Status

()

Core
CSS Parsing and Computation
VERIFIED INVALID
14 years ago
11 months ago

People

(Reporter: Magnus Melin, Assigned: dbaron)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

649 bytes, application/xhtml+xml
Details
(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7b) Gecko/20040421 MultiZilla/1.6.3.0e
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7b) Gecko/20040421 MultiZilla/1.6.3.0e

When using e.g.
<style type="text/css">
input:before {
  content: "" attr(name) ": ";
}
</style>

no content is generated



Reproducible: Always
Steps to Reproduce:
1. See testcase
2. 

Actual Results:  
In 1.7rc1, you see only input fields, no text

Expected Results:  
Should output
cast: [input field] category: [input field] [submit]

This worked in 1.6
(Reporter)

Comment 1

14 years ago
Created attachment 147249 [details]
testcase

Comment 2

14 years ago
Generated content on "replaced elements" has been disabled (per CSS 2.1).

(FORM elemetns aren't really replaced like IMG, but they behave the same.)
Whiteboard: DUPEME
No CSSOM involved.

David, are we just marking these invalid, or what?
Assignee: general → dbaron
Component: DOM: CSSOM → Style System (CSS)
Marking invalid.  This is as-designed.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → INVALID
Whiteboard: DUPEME
(Reporter)

Comment 5

14 years ago
Ok. For reference, functionality was obviously changed by the patch for bug 169334.
Status: RESOLVED → VERIFIED

Comment 6

13 years ago
*** Bug 283808 has been marked as a duplicate of this bug. ***

Comment 7

12 years ago
*** Bug 304279 has been marked as a duplicate of this bug. ***

Comment 8

11 years ago
*** Bug 351758 has been marked as a duplicate of this bug. ***
(Assignee)

Updated

8 years ago
Summary: CSS input:after generated content broken in 1.7rc1 → CSS generated content does not work on replaced elements (img, form controls, etc.)
(Assignee)

Updated

8 years ago
Duplicate of this bug: 546367
(Assignee)

Updated

8 years ago
Duplicate of this bug: 557306
(Assignee)

Updated

8 years ago
OS: Linux → All
Hardware: x86 → All
Duplicate of this bug: 669080
Duplicate of this bug: 724369

Comment 13

4 years ago
This works with Chrome (blink), since their form controls are implemented by Shadow DOM (thus having a DOM subtree to insert the pseudo elements).
Shadow DOM shouldn't matter here.  Per spec, ::before and ::after are supposed to act exactly like normal DOM children.  If an actual DOM child wouldn't appear in the rendering, neither should ::before and ::after.  If Blink is implementing something else, then it's just not following the spec.
That said, I just tried this in Chrome with an <input type="button"> and the ::before doesn't show up there, as expected.  So I have no idea what comment 13 is talking about.
Duplicate of this bug: 765035

Comment 17

3 years ago
I'm using input[type=checkbox]:before to re-style checkboxes (make the checkbox visibility:hidden and use :before to create the box) and it works fine in Chrome 37, but nothing shows up in Firefox 32.
That's a bug in Chrome, afaict, since it doesn't allow rendering normal kids of a checkbox.

Updated

3 years ago
Duplicate of this bug: 1157575

Comment 20

a year ago
I came here with the same issue as Jason. Works in Chrome, but not in Firefox.

https://bugzilla.mozilla.org/show_bug.cgi?id=241985#c17

Comment 21

a year ago
Here's an example: https://s.codepen.io/kevinSuttle/debug/OXybrJ
The example URL from comment 21 doesn't show the quote character in Chrome, either in dev channel or release.

Comment 23

a year ago
@Boris Zbarsky I'm not sure what you mean. Are you referring to the `content: close-quote` property? https://developer.mozilla.org/en-US/docs/Web/CSS/content#Values
Yes, the actual thing that uses generated content there.

Comment 25

a year ago
Good observation. I have actually never seen it rendered.

Updated

11 months ago
Duplicate of this bug: 1320751
You need to log in before you can comment on or make changes to this bug.