, 2 , .
, Chrome Opera, IE, preserveAspectRatio="xMinYMin slice", Firefox .
-, :
a) SVG - Ch, O, IE
b) getComputedStyle:
var style = window.getComputedStyle(svg, null);
var svgWidth = style.getPropertyValue("width").slice(0, -2);
, , 60 ,
c) , ,
<div><svg style="width:100%; height:100%"></svg></div>
SVG 1 Firefox.. , div, ! , IE.
, :
if(!svg.width.baseVal.value || svg.width.baseVal.value < 2){
if(!this.parentElement) return;
this.width = this.parentElement.clientWidth;
this.height = this.parentNode.clientHeight;
}
else{
this.width = svg.width.baseVal.value;
this.height = svg.height.baseVal.value
}