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

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

From: Amelia Bellamy-Royds <amelia.bellamy.royds@gmail.com>
Date: Thu, 6 Oct 2016 10:47:13 -0600
Message-ID: <CAFDDJ7woqbTXC0xwrCR0qKcWkEQJ-aKinAXkv7h7P78upNYJsA@mail.gmail.com>
To: Sebastian Zartner <sebastianzartner@gmail.com>
Cc: www-svg <www-svg@w3.org>
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.

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

~ABR

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 Thursday, 6 October 2016 16:47:46 UTC

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