The following code:
<!DOCTYPE html>
<html>
<head>
<title>Test.</title>
</head>
<body>
<div style="border: solid 1px black; height:100px; width:100px">
<svg height="100" width="100" viewbox="00 0 100 100">
<path id="map1" d="M210 10 L90 10 L90 90 " fill="red"/>
</svg>
</div>
</html>
JSFiddle: http://jsfiddle.net/HRsvX/
In Chrome and FF4 displays div with border and part of image that is INSIDE of SVG-object. Everything outside of the svg is not drawn.
IE9 displays WHOLE SVG-image. Is it a feature or a bug? Is there any way to cut the ‘outbounding’ part of image?
Does Raphael framework handle such case correctly?
Edit: In light of my new understanding of the spec, I must correct myself below.
The default style required by the spec for elements in the svg namespace is:
per http://www.w3.org/TR/SVG/styling.html#UAStyleSheet
So, if you want IE9 to conform you can use:
As suggested here and here.
The following is true if the default
overflow: hiddenis overridden:According to the SVG Spec, SVG handles
overflowlike any other element when contained within a document that is using CSS. Items inside of the element overflow unlessoverflow: hiddenoroverflow:scrollif they exceed the size of the parent.In your example, I see it as the
pathexceeds theviewboxdefined on thesvgelement. Since the defaultoverflowisvisible, the path will “bleed” beyond thesvgelement’s boundries. Additionally, it bleeds beyond thesvgelement’s parent boundries, etc.