Re: text-decorations propagating into SVG

On Tue, Aug 26, 2014 at 8:09 AM, Paul LeBeau <paul.lebeau@gmail.com> wrote:
> Yesterday I discovered that both Chrome and FF are propagating
> text-decoration into SVG and onto <text> elements.  So, in the following
> example, "Foo" is underlined and cannot be disabled, unless it is removed
> from the parent <a>.
>
> <a>
>   <svg>
>     <text>Foo</text>
>   </svg>
> </a>
>
> This didn't seem quite right to me, so I filed bugs for both browsers.  FF's
> argument is that text decorations draw across descendant elements. (See
> https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration#Notes).
> However the CSS spec says:
>
>> For block containers that establish an inline formatting context, the
>> decorations are propagated to an anonymous inline element that wraps all the
>> in-flow inline-level children of the block container. For all other elements
>> it is propagated to any in-flow children. Note that text decorations are not
>> propagated to floating and absolutely positioned descendants, nor to the
>> contents of atomic inline-level descendants such as inline blocks and inline
>> tables.
>
>
> Wouldn't <text> elements be exempt from inheriting the underline for either
> or both of the following reasons:
> (a) SVG elements do not establish an inline formatting context, and <text>
> elements are not in-flow children.
> (b) <text> elements are absolutely positioned descendants.
>
> I guess it depends whether you consider that the content of <text> elements
> constitute a "flow" in the CSS sense, and whether SVG elements are
> absolutely positioned in the HTML/CSS sense.

You can't use (b) as a justification, as it would prevent <text> from
*ever* being underlined, even when it's a direct child of an <svg:a>
element.

I would think that an inline-leve <svg> should be considered an atomic
inline, though.  This wouldn't stop decorations from propagating into
a block-level <svg>, though.

Note as well that the next level of Text has the ability to stop
decorations from propagating.

~TJ

Received on Tuesday, 26 August 2014 00:36:43 UTC