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

Hi Amelia,

sorry for the late reply!

On 6 October 2016 at 18:47, Amelia Bellamy-Royds <> 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
<> 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.


On 6 October 2016 at 02:46, Sebastian Zartner <>
> 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]

Received on Tuesday, 11 October 2016 08:57:39 UTC