W3C home > Mailing lists > Public > www-svg@w3.org > October 2016

Re: How does <view> work for SVG embedded into HTML?

From: Sebastian Zartner <sebastianzartner@gmail.com>
Date: Tue, 11 Oct 2016 10:56:50 +0200
Message-ID: <CAERejNbNWvh67XjDf6C5hivfUoOLs0ChwT7XNVJ+yeCkWmM9ag@mail.gmail.com>
To: Amelia Bellamy-Royds <amelia.bellamy.royds@gmail.com>
Cc: www-svg <www-svg@w3.org>
Hi Amelia,

sorry for the late reply!

On 6 October 2016 at 18:47, Amelia Bellamy-Royds <
amelia.bellamy.royds@gmail.com> wrote:

> As it's currently defined in the SVG spec, targetting a <view> is supposed
> to affect the nearest SVG ancestor. Which means it could apply to inline
> SVG.  However, as you note, the problem is that target fragments are
> interpretted in the context of the document as a whole.  For HTML, that
> means scrolling into view and turning on CSS :target styles.
>
> I think it would be fairly straightforward for HTML to say that if the
> targetted element is an SVG element, apply the additional behavior from the
> SVG spec. HTML wouldn't have to support #svgView() fragments (since they
> wouldn't make sense applied to the document as a whole), but view and
> animation behaviors (change view or start animation when targetting that
> element's id) *should* work.
>
> But, it's one of those things that has so far fallen through the cracks
> between the HTML and SVG specs, and so far, there hasn't been any
> significant interest in fixing that.
>

So, what should be done now? File an issue against the HTML spec.? File an
issue against the SVG spec.? File issues against the different
implementations? Or just forget about it, because implementors and/or spec.
writers don't care enough about it?

Btw. I don't see a possibility to apply the view programmatically through
the SVGViewElement
<https://svgwg.org/svg2-draft/linking.html#InterfaceSVGViewElement> API. I
think it would make sense to add an apply() (or use() or show(); the name
needs to be bikeshedded) method to it. That would be another possibility to
achieve the same and might be a workaround in case the fragment identifier
issue won't be solved.


> It's too bad. Views are a cool feature that doesn't really get used much
> anymore, in particular because they don't work for inline SVG, and are
> buggy for images (changing the aspect ratio doesn't work correctly in most
> browsers).
>

I agree that it's a cool feature, though without proper browser and spec.
support, its usefulness is limited.

Sebastian

On 6 October 2016 at 02:46, Sebastian Zartner <sebastianzartner@gmail.com>
> wrote:
>
>> Recently I've created an example for the <view> element on MDN[1],
>> though clicking the links doesn't have any effect, but if the SVG is
>> saved as standalone file and or embedded via an <object> element, it
>> works fine. I've observed this behavior in Firefox 49.0.1, Chrome 53.0
>> and Opera 40.0.
>>
>> So I was wondering whether that's expected behavior. I assume that is
>> because in case of embedded SVG the fragment identifier is attached to
>> the URL of the HTML document instead of the SVG.
>> If that's the reason, how can the <view> element take effect in
>> embedded SVG then?
>>
>> Sebastian
>>
>> [1] https://developer.mozilla.org/en-US/docs/Web/SVG/Element/view#Example
>>
>>
>
Received on Tuesday, 11 October 2016 08:57:39 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:55:06 UTC