Suppose you have multiple SVG tags where in each you define a different clip path with the same ID.
<svg id="svg1" width="200" height="200">
<defs>
<clipPath id="nodeclipper">
<rect width="100" height="100" x="0" y="0" />
</clipPath>
</defs>
</svg>
<svg id="svg2" width="200" height="200">
<defs>
<clipPath id="nodeclipper">
<circle cx="20" cy="0" r="40" />
</clipPath>
</defs>
</svg>
I also made a JSFiddle. What is the expected behaviour? I thought that an element could only reference definitions inside its own SVG tag, but that doesn't seem to be the case:
- Chrome 26: Uses
circle
clip path two times. - Firefox 17: Uses
rect
clip path two times. - Safari 6: Renders one
rect
and onecircle
clip path as expected.
It gets weird when you hide one of the SVG tags because Chrome and Safari then drop the clip-path
entirely.
I know it works when the clipPath
s have different IDs but is it supposed to be that way? As far as I see the spec doesn't contain information about the issue.