New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 597466 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Last visit > 30 days ago
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Blink supports generated content on any element

Reported by gw...@microsoft.com, Mar 24 2016

Issue description

Version: 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).
 

Comment 1 by rbyers@chromium.org, Mar 24 2016

Components: Blink>CSS

Comment 2 by rbyers@chromium.org, Mar 24 2016

Cc: tabatkins@chromium.org
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.

Comment 3 by rbyers@chromium.org, 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.
Labels: Needs-Feedback

Comment 5 Deleted

Comment 6 by rbyers@chromium.org, 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

Comment 7 by rbyers@chromium.org, Mar 24 2016

Labels: -Needs-Feedback

Comment 8 by math...@qiwi.be, 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!';
    }
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.

Comment 10 by loyso@chromium.org, Mar 28 2016

Labels: OS-All
Status: Available (was: Untriaged)
Labels: -Pri-1 Pri-2
Owner: tabatkins@chromium.org
Status: Assigned (was: Available)
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?
Yeah, at the last CSSWG f2f, we ended up standardizing on the WebKit/Blink behavior.
Cc: nainar@chromium.org
Status: Fixed (was: Assigned)
Closing as Fixed as per Comments #11, #12. Please change the status if I am incorrect.

Comment 14 by phistuck@gmail.com, Sep 13 2016

Perhaps a WontFix is more appropriate here, as nothing was changed (no code changes).
Status: WontFix (was: Fixed)
Yup you're right. Thanks!
Changing the status.

Sign in to add a comment