Re: [css3-content] sizing of images inserted using the content property

On Wednesday 2011-11-23 08:40 -0800, Tab Atkins Jr. wrote:
> On Wed, Nov 23, 2011 at 8:29 AM, L. David Baron <dbaron@dbaron.org> wrote:
> > On Monday 2011-11-21 08:19 -0500, Boris Zbarsky wrote:
> >> On 11/21/11 7:44 AM, Florian Rivoal wrote:
> >> >Section "8. Replaced content" says that when the content introduced by
> >> >content: is a single url, then the element or pseudo element is a
> >> >replaced element.
> >>
> >> This happens to not be compatible with what the "content" property
> >> does in CSS 2.1, for what it's worth....
> >
> > I think you're misinterpreting what it says, or at least what it
> > intended to say (since I think there's a section missing... though
> > I'm having a bit of trouble reading the spec due to the obsoletion
> > notice).
> 
> If Firefox supported <details>, you'd be able to dismiss the notice.  ^_^
> 
> 
> > http://dev.w3.org/csswg/css3-content/#inserting-and-replacing-content-with-the
> > describes the value of 'content' as:
> >
> >  [ [ <uri> | icon ] ‘,’ ]* [ normal | none | inhibit | <content-list> ]
> >
> > url() values can appear in two different places in this syntax:
> > before a "," or inside of <content-list>.  When they appear before a
> > "," they are treated as a replaced element (as the spec describes).
> > When they appear inside of <content-list>, they are processed under
> > the CSS 2.1 model and are not a replaced element.  (This bit is less
> > clear because some of the subsections under <content-list> appear to
> > be missing.)
> >
> > If 'content' contains a single url(), the only way to make the value
> > fit the grammar is by making that url() part of the <content-list>
> > production, in which case it is not treated as a replaced element.
> 
> Is this a desirable pattern?

It seems no harder to specify:
  content: url(foo.png), "";
than to specify:
  content: replaced url(foo.png);
as you proposed earlier in this thread.  And, furthermore, it
encourages authors to think about whether they should be providing
alternative text.

> On Wed, Nov 23, 2011 at 8:35 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> > On 11/23/11 11:29 AM, L. David Baron wrote:
> >> If 'content' contains a single url(), the only way to make the value
> >> fit the grammar is by making that url() part of the<content-list>
> >> production, in which case it is not treated as a replaced element.
> >
> > Ah, ok.  That makes sense, and seems backwards-compatible.  Is that what
> > WebKit and Opera actually implement, though?
> 
> Not WebKit.  We currently make "div { content: url(foo); }" turn the
> div into a replaced element.

But only if it's on an element and not on a pseudo-element?

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂

Received on Wednesday, 23 November 2011 17:34:16 UTC