W3C home > Mailing lists > Public > www-style@w3.org > February 2012

Re: [css3-images] Referencing <svg> element directly with element()

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 22 Feb 2012 09:35:48 -0800
Message-ID: <CAAWBYDChbOLeQQN4H+RM=gXmWsCCj4PJ0ZoReEKUnS1=g9D5jA@mail.gmail.com>
To: Erik Dahlstrom <ed@opera.com>
Cc: www-style@w3.org
[rearranged for better reply order]

On Wed, Feb 22, 2012 at 3:15 AM, Erik Dahlstrom <ed@opera.com> wrote:
> It seems to me that even the paint server model (svg gradients, patterns)
> that is defined in the spec suffers from the same problem, even if the <svg>
> contained only elements inside a <defs> the <svg> itself would still take up
> space in the main document.

If the SVG contains only paint servers, you can set it to
display:none.  They'll still be usable in element().

> using the element() notation and referencing an <svg> element[1], I'm
> wondering if it is possible to reference a whole <svg> fragment which in
> itself is not rendered? One that only renders when referenced via element()
> but which is invisible and doesn't take up any space in the main document?
> One way to solve that might be to use cssElementMap, but that has the
> drawback of having to use scripting. Is there a script-less way of doing
> this?
> Please
> consider making <svg> as a "paint source" as well. That would make svg
> easier to use here, since you wouldn't have to wrap the content inside a
> <pattern> element.

As Boris says, you can't do this in general, since there may be
dependencies on the outside world for style information, percentages,
etc.  I could finesse a definition that avoided some of these, but
it's simpler to just require <pattern> and be done with it, both from
a spec perspective and an author-learning perspective.

Hmm.  <pattern> removes the layout-information dependencies, but not
the style dependencies.  I've now corrected that so that paint sources
that aren't rendered use initial values if they try to inherit.

> If I understand the spec correctly, elements that are "paint sources" (e.g
> <img>, <canvas> and <video>) can still be used when referenced via element()
> even if they are not rendered. Please clarify what "not rendered" means.
> Would display:none be included in that definition for example?

Yes, display:none is included in that.  I've clarified the term now -
it's defined as any element that does not generate a box, or which is
a descendant of <defs> in SVG.

Are these responses acceptable?

Received on Wednesday, 22 February 2012 17:36:40 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:11 UTC