The SVG DOM is different to the HTML DOM (which jquery was written for) 
- a lot of things are the same, so you may have some luck using jquery 
in SVG (there are some threads dealing with SVG related issues in this 
list which should give you an indication of what to look out for).

In the last SVG project I was involved in, I treated the SVG and HTML 
completely separately, mainly because:
1. I could not find a way to access the SVG DOM from HTML in Safari.
2. I wanted to use AJAX, and needed to do it the same way across SVG 
implementations (using getURL in Adobe SVG viewer and XMLHttpRequest in 
others), so the AJAX code I needed had to be separate from the AJAX code 
used in the HTML pages.
3. I found that embedding the SVG file was best achieved in different 
ways across different browser/viewer configurations 
(object/embed/iframe) - this was mainly a source of annoyance, but made 
me feel that It would be best to separate the two from each other 
completely.

I think if I wanted to use jQuery in SVG, I would get the source and try 
to port it (or the parts I was interested in using) to the SVG DOM so 
all HTML/CSS and browser-related fixes were discarded and fixes for 
different viewers put in place instead. This would be made much easier 
if you target a single browser implementation (such as Firefox or Opera) 
- trying to take into account the differences between different SVG 
viewer/browser combinations is quite a task, and one I abandoned quite 
early.

Hope this helps.

on 24/03/2008 10:26 zipman said::
> Anyone?
> 
> On Mar 23, 8:02 pm, zipman <[EMAIL PROTECTED]> wrote:
>> 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?
> 

Reply via email to