jquery.offset
always returns 0/0 when applied to an SVG element in chrome.
<div style="margin: 45px;">
<svg version="1.1" width="100" height="100" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1,0,0,1,10,10)">
<path id="zeroPoint" d="M10,5 a5,5 0 0 1 -5,5 l0,-5 zM0,5 a5,5 0 0 1 5,-5 l0,5 zM5,0 a5,5 0 0 1 5,5 l-0.2,0 a 4.8,4.8 0 0 0 -4.8,-4.8 zM5,10 a5,5 0 0 1 -5,-5 l0.2,0 a 4.8,4.8 0 0 0 4.8,4.8 z" transform="matrix(2,0,0,2,-9.71428,-9.71428)"></path>
</g>
</svg>
</div>
Calling $('#zeroPoint').offset()
in Chrome (at least versions 40 - 52 (cur stable) & 53 dev) returns the erroneous position top: 0, left: 0
whilst Firefox 48, IE 11 & Edge 13 return top: 45.xx, left: 53.xx
.
Any ideas why that is?
One more thing:
The offset
method was working proberly in Chrome in jQuery version <= 2.2.4:
JSFiddle with jQuery v2.2.4