I\'ve run into this problem a lot with D3. A lot of the time I like to overlay HTML objects over my SVG.
My current strategy is creating an empty DIV next to the SV
Extending James Lai's answer to support modern versions of IE:
function getVpPos(el) { if(el.parentNode.nodeName === 'svg') { return el.parentNode.getBoundingClientRect(); } return getVpPos(el.parentNode); }
Note: parentElement is changed to parentNode and tagName is changed to nodeName.