Created attachment 8489950 [details] testcase 1 -- Click "[sub view]" text to test User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36 Steps to reproduce: The SVG 1.1 spec http://www.w3.org/TR/SVG/linking.html#SVGFragmentIdentifiers specifies: If the SVG fragment identifier addresses a ‘view’ element within an SVG document (e.g., MyDrawing.svg#MyView or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor ‘svg’ element is displayed in the viewport. So in the following SVG only the nested <svg> with id "inner" should be rendered when the <view> element is linked. <svg> ... content not rendered... <svg id="inner"> .. content that *is* rendered... <view id="test" .../> </svg> </svg> This is not what happens in FF however. All views are treated the same. Expected results: In the attached test file, the red square and yellow rectangle should not be rendered.
Yup, the spec does say to only display "the closest ancestor 'svg' element", and we don't seem to have that implemented. The text seems to be the same in SVG2, too: http://www.w3.org/TR/SVG2/linking.html Paul: Do you know if this works correctly in any rendering engine? (I tested Opera 12.16 [Presto] and it matches the current Firefox behavior; Chrome 39 [Blink] doesn't do anything at all when I click the link in the testcase.)
Indeed, I didn't implement it because nobody else did and I didn't have any testcases I could rely on.
We could, of course just fix the spec so that it always goes to the root svg element and not implement this as it seems that nobody really wants it.
I tried FF, Chrome, IE and Batik. Only the first two support view IRIs anyway. View IRIs could be useful if they worked everywhere - eg. SVG sprite sheets. But I'm not sure what extra usefulness the nested view rule adds to views in general. Also the spec isn't clear what exactly what "only displaying the closest ancestor" means anyway. I can think of three ways someone might implement that: 1) Use the outermost <svg> for the viewport, but only display the nested one. 2) Treat the nested SVG as the outermost <svg> and use it for the viewport. 3) Apply the <view> viewBox to the outermost <svg> but only display the nested one. So given that no-one implements it, and it is hidden behind a feature (view IRIs) that only half the browsers support anyway, I am leaning towards Robert's suggestion to propose its removal.
Correction: only FF and Batik (and, as Daniel discovered, Opera) support view IRIs.