[jQuery] events on embedded SVG

[jQuery] events on embedded SVG


Hello,
I am having an html page and I embed an svg file through.
<object id="map" data="/Demo/map.svg" type="image/svg+xml"
height="500" width="600">
</object>
or even
<embed id="map" src="/Demo/map.svg" type="image/svg+xml" height="500"
width="600">
The problem is that I cannot access the elements inside the svg file
through jquery.
I can do
htmlObj = document.getElementById("map");
/*//this works only in IE
SVGDoc = htmlObj.getSVGDocument();*/
//this works in firefox
SVGDoc = htmlObj.contentDocument;
and then access any element by getElementById
eg when I want to access an elements with id="test"
I do it by SVGDoc.getElementById('test');
The problem is that the contents of the SVG are not appended to the
DOM
tree so methods like $('#test') do not work.
Is there any way to make this work?