Blink supports generated content on any element
Reported by
gw...@microsoft.com,
Mar 24 2016
|
||||||||
Issue descriptionVersion: 49.0.2623.87 OS: Windows 10 What steps will reproduce the problem? (1) Open https://jsfiddle.net/btw9uqn6/ What is the expected output? No image is seen What do you see instead? An image is inserted into the DOM element Additional information: ----------------------- Gecko: No Repro Edge: No Repro Webkit: Repro Blink: Repro What the specs say ----------------------- The CSS 2.1 specification states (https://www.w3.org/TR/CSS2/generate.html#content) that it applies to :before and :after psuedo elements. While the css-content-3 allow for it to be on all elements but this specification is not ready for implementation per the red error note (https://drafts.csswg.org/css-content-3/#inserting-replacing-content).
,
Mar 24 2016
This is probably the spec reference we'd consider authoritative: https://drafts.csswg.org/css2/generate.html#propdef-content One option is obviously just getting this added to CSS 2.2. Greg, any preference one way or the other? I'll leave this Untriaged for the CSS experts to look into.
,
Mar 24 2016
Oh also, do you have examples of sites hitting this? I see you marked it Pri=3 so guessing it's not a common source of interop issues, right? If we've seen it cause problems more than once in the wild, I'd suggest upgrading to Pri-2.
,
Mar 24 2016
,
Mar 24 2016
Context: https://twitter.com/gregwhitworth/status/712800048837341184, including: Mike Taylor @miketaylr: that quirk prevents us from shipping `-webkit-device-pixel-ratio` cf., https://bugzilla.mozilla.org/show_bug.cgi?id=1237101#c6 Google docs is apparently depending on this quirk somewhere - we should either standardize the API or break it. Sounds like may be Pri-1 (or at least Pri-2) to me. Also WebKit issue: https://bugs.webkit.org/show_bug.cgi?id=155820
,
Mar 24 2016
,
Mar 24 2016
FWIW, Presto-based Opera 12 used to support generated content on any element, including text content (not just `url(foo)` like in Blink).
E.g.
html {
content: 'Yay, CSS!';
}
,
Mar 28 2016
CSSWG has always intended to have 'content' work on every element, so I'm in favor of us keeping this behavior, and getting the specs to align. That said, our current behavior violates what the spec would say - as Comment 8 says, we only allow images when applied to arbitrary elements, when we *should* be allowing text as well. Also, for both pseudo-elements and normal elements, we have the magic "if the value is a single url(), treat the element as a replaced element" behavior which doesn't even match the 2.1 spec. That said, this is clearly a good behavior that we should get the specs to support; users that wanted the old behavior (of the image being a replaced-element *child* of the container) could get it with "content: url(...) '';" - just use an empty string to opt into the generic "this is all child contents" behavior.
,
Mar 28 2016
,
Jul 25 2016
Actually it looks like there's an updated spec for this here: https://drafts.csswg.org/css-content/#content-property It says: "content applies to: ::before, ::after, ::marker, and page margin boxes. Image and url values can apply to all elements." So this is WAI according to the current spec, right? Tab / Greg?
,
Jul 25 2016
Yeah, at the last CSSWG f2f, we ended up standardizing on the WebKit/Blink behavior.
,
Sep 13 2016
Closing as Fixed as per Comments #11, #12. Please change the status if I am incorrect.
,
Sep 13 2016
Perhaps a WontFix is more appropriate here, as nothing was changed (no code changes).
,
Sep 13 2016
Yup you're right. Thanks! Changing the status. |
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by rbyers@chromium.org
, Mar 24 2016