Connecting Tech Pros Worldwide Forums | Help | Site Map

FF SVG and DOM Level 1

Aaron Gray
Guest
 
Posts: n/a
#1: Dec 22 '06
AFAICT FireFox SVG does not work with DOM Level 1 constructs, it needs
Namespaces.

Is this correct ?

Aaron



Martin Honnen
Guest
 
Posts: n/a
#2: Dec 22 '06

re: FF SVG and DOM Level 1


Aaron Gray wrote:
Quote:
AFAICT FireFox SVG does not work with DOM Level 1 constructs, it needs
Namespaces.
>
Is this correct ?
SVG is XML with at least two namespaces (the SVG one:
http://www.w3.org/2000/svg, the XLink one: http://www.w3.org/1999/xlink)
and to manipulate XML with namespaces (with Mozilla or elsewhere) you
need at least the namespace aware DOM Level 2 Core. Mozilla supports
that, even before it supported SVG so I am not sure what the problem is.
Use namespace aware methods like document.createElementNS,
getElementsByTagNameNS, setAttributeNS with the proper namespaces and
you can script SVG in Mozilla just fine.
For more details see
<http://jwatt.org/svg/authoring/#namespace-aware-methods>.


--

Martin Honnen
http://JavaScript.FAQTs.com/
Aaron Gray
Guest
 
Posts: n/a
#3: Dec 22 '06

re: FF SVG and DOM Level 1


>AFAICT FireFox SVG does not work with DOM Level 1 constructs, it needs
Quote:
Quote:
>Namespaces.
>>
>Is this correct ?
>
SVG is XML with at least two namespaces (the SVG one:
http://www.w3.org/2000/svg, the XLink one: http://www.w3.org/1999/xlink)
and to manipulate XML with namespaces (with Mozilla or elsewhere) you need
at least the namespace aware DOM Level 2 Core. Mozilla supports that, even
before it supported SVG so I am not sure what the problem is.
Manipulating both MS IE Adobe SVG pluging and FF SVG in a single SVG
document.

Opera has no problem with scripting either the IE Adobe SVG documents or the
FF SVG documents.

But can I get MS and FF to play one the same document ? No not so far.
Quote:
Use namespace aware methods like document.createElementNS,
getElementsByTagNameNS, setAttributeNS with the proper namespaces and you
can script SVG in Mozilla just fine.
For more details see
<http://jwatt.org/svg/authoring/#namespace-aware-methods>.
Yes I have working examples of this.

Aaron


Martin Honnen
Guest
 
Posts: n/a
#4: Dec 22 '06

re: FF SVG and DOM Level 1


Aaron Gray wrote:
Quote:
Quote:
Quote:
>>AFAICT FireFox SVG does not work with DOM Level 1 constructs, it needs
>>Namespaces.
>>>
>>Is this correct ?
>SVG is XML with at least two namespaces (the SVG one:
>http://www.w3.org/2000/svg, the XLink one: http://www.w3.org/1999/xlink)
>and to manipulate XML with namespaces (with Mozilla or elsewhere) you need
>at least the namespace aware DOM Level 2 Core. Mozilla supports that, even
>before it supported SVG so I am not sure what the problem is.
>
Manipulating both MS IE Adobe SVG pluging and FF SVG in a single SVG
document.
I am not sure what the problem is for pure SVG, for IE and the Adobe SVG
plugin the DOM implementation that you script is provided by the Adobe
plugin and that implementation supports DOM Level 2 core
<http://home.arcor.de/martin.honnen/svg/test2006122201.svg>

Quote:
Opera has no problem with scripting either the IE Adobe SVG documents or the
FF SVG documents.
>
But can I get MS and FF to play one the same document ? No not so far.
Can you post example code that does not work? Or a URL where things go
wrong? If you have code embedding SVG in HTML/XHTML then with IE and
Adobe it is only a question of getting at the Adobe SVG DOM document and
using its DOM Level 2 support.

--

Martin Honnen
http://JavaScript.FAQTs.com/
VK
Guest
 
Posts: n/a
#5: Dec 22 '06

re: FF SVG and DOM Level 1


Aaron Gray wrote:
Quote:
Manipulating both MS IE Adobe SVG pluging and FF SVG in a single SVG
document.
An amount of IE users with Adobe SVG Viewer installed is totally
negligible (a few curious ones per maybe 10,000). And the idea that
every visitor will rush to install a 2.3Mb unknown discontinued plugin
is overly optimistic IMHO.

It is also still a mystery to me why does anyone think that with a
miracle happened and the given IE having some SVG plugin installed -
why will it necessary be Adobe SVG Viewer? It can be as well say Corel
SVG Viewer - with its "unlimited zoom" feature it could be the first
choice for some cartography-related intranet. See also
<http://www.carto.net/papers/svg/utils/SVGSwitch.shtml>

Having said all these nasties :-) -
Adobe SVG Viewer implements slightly different scriptable DOM model,
see for instance
<http://www.adobe.com/svg/demos/colorpicker/colorpicker.htmland
google for more samples
For a sophisticated sample of Adobe SVG Viewer scripting see
<http://www.lutanho.net/svgvml3d/index.html>. This also will show you
the right - IMHO - way to handle IE.

Aaron Gray
Guest
 
Posts: n/a
#6: Dec 22 '06

re: FF SVG and DOM Level 1


"Martin Honnen" <mahotrash@yahoo.dewrote in message
news:458beb81$0$18834$9b4e6d93@newsspool4.arcor-online.net...
Quote:
Aaron Gray wrote:
Quote:
Quote:
>>>AFAICT FireFox SVG does not work with DOM Level 1 constructs, it needs
>>>Namespaces.
>>>>
>>>Is this correct ?
>>SVG is XML with at least two namespaces (the SVG one:
>>http://www.w3.org/2000/svg, the XLink one: http://www.w3.org/1999/xlink)
>>and to manipulate XML with namespaces (with Mozilla or elsewhere) you
>>need at least the namespace aware DOM Level 2 Core. Mozilla supports
>>that, even before it supported SVG so I am not sure what the problem is.
>>
>Manipulating both MS IE Adobe SVG pluging and FF SVG in a single SVG
>document.
>
I am not sure what the problem is for pure SVG, for IE and the Adobe SVG
plugin the DOM implementation that you script is provided by the Adobe
plugin and that implementation supports DOM Level 2 core
<http://home.arcor.de/martin.honnen/svg/test2006122201.svg>
This gives a blank page on IE7 with Adobe SVG.
Quote:
Quote:
>Opera has no problem with scripting either the IE Adobe SVG documents or
>the FF SVG documents.
>>
>But can I get MS and FF to play one the same document ? No not so far.
>
Can you post example code that does not work? Or a URL where things go
wrong?
I will do so soon, but I want to whittle what I have down first and do some
examples that work on IE and some that work on FF. BTW Opera does not seem
to be a problem.
Quote:
If you have code embedding SVG in HTML/XHTML then with IE and Adobe it is
only a question of getting at the Adobe SVG DOM document and using its DOM
Level 2 support.
Right.

Thanks,

Aaron



Aaron Gray
Guest
 
Posts: n/a
#7: Dec 23 '06

re: FF SVG and DOM Level 1


<http://www.lutanho.net/svgvml3d/index.html>. This also will show you
Quote:
the right - IMHO - way to handle IE.
This is great. Use VML for IE and SVG for browsers that support SVG. Very
obvious.

The IE code does a DOM Level 1, "createElement( 'v:group')" rather than a
DOM Level 2, "createElementNS( ns, tag)".

Great. Too obvious.

Thanks for the link,

Aaron



Martin Honnen
Guest
 
Posts: n/a
#8: Dec 23 '06

re: FF SVG and DOM Level 1


Aaron Gray wrote:
Quote:
Quote:
><http://home.arcor.de/martin.honnen/svg/test2006122201.svg>
>
This gives a blank page on IE7 with Adobe SVG.

That is possible, I have seen a lot of people complain that IE 7 and
Adobe SVG viewer somehow fail to render a standalone SVG document.
I use IE 6 and Adobe SVG viewer and the SVG renders fine.
Nevertheless that example contains a static text element and a
dynamically created circle element in the SVG document, if nothing is
rendered at all then it is not a problem with the DOM scripting but
simply a problem with IE 7 and Adobe SVG viewer not rendering an SVG
document at all if it is not embedded in aother document. I don't know a
solution for that problem.

Here is the same SVG document embedded in an HTML document, that should
do even with IE 7 and show that the DOM the Adobe SVG viewer offers
supports createElementNS and setAttributeNS:
<http://home.arcor.de/martin.honnen/svg/test2006122301.html>



--

Martin Honnen
http://JavaScript.FAQTs.com/
Aaron Gray
Guest
 
Posts: n/a
#9: Dec 23 '06

re: FF SVG and DOM Level 1


Here is the same SVG document embedded in an HTML document, that should do
Quote:
even with IE 7 and show that the DOM the Adobe SVG viewer offers supports
createElementNS and setAttributeNS:
<http://home.arcor.de/martin.honnen/svg/test2006122301.html>
Yes, thats working fine now.

<script type="text/ecmascript">

Yes, the ECMA Script seems to be the answer for doing DOM Level 2 code in
SVG. I have been using just <scriptwhich only supports DOM Level 1.

Yes it works on IE6 and IE7 on XP and IE7 on Vista, all with Adobe plugin.

My only concern with this is whether all SVG clients support ECMA Script.
But as Adobe, FireFox and Opera support it I can see no reason not to use
it.

I will try the new EmiaSys Renesis plugin later today :-

http://www.emiasys.net/

Many thanks for your help,

Aaron



Martin Honnen
Guest
 
Posts: n/a
#10: Dec 23 '06

re: FF SVG and DOM Level 1


Aaron Gray wrote:
Quote:
<script type="text/ecmascript">
>
Yes, the ECMA Script seems to be the answer for doing DOM Level 2 code in
SVG. I have been using just <scriptwhich only supports DOM Level 1.
The level of DOM support does certainly not depend on the type attribute
of the SVG script element. I use <script type="text/ecmascript" in SVG
instead of <script type="text/javascript"in HTML as at least the Batik
squiggle SVG viewer prefers text/ecmascript, mainly because the SVG
specification (1.1) uses that as the media type name.



--

Martin Honnen
http://JavaScript.FAQTs.com/
Aaron Gray
Guest
 
Posts: n/a
#11: Dec 23 '06

re: FF SVG and DOM Level 1


> <script type="text/ecmascript">
Quote:
Quote:
>>
>Yes, the ECMA Script seems to be the answer for doing DOM Level 2 code in
>SVG. I have been using just <scriptwhich only supports DOM Level 1.
>
The level of DOM support does certainly not depend on the type attribute
of the SVG script element. I use <script type="text/ecmascript" in SVG
instead of <script type="text/javascript"in HTML as at least the Batik
squiggle SVG viewer prefers text/ecmascript, mainly because the SVG
specification (1.1) uses that as the media type name.
Batik Squiggle ? Thats a funny name :) Java Apache SVG Browser :]

I'll may well check that out at some point.

Are there any other SVG Brosers/plugins to support ?

Aaron




Closed Thread