FF SVG and DOM Level 1

A

Aaron Gray

AFAICT FireFox SVG does not work with DOM Level 1 constructs, it needs
Namespaces.

Is this correct ?

Aaron
 
M

Martin Honnen

Aaron said:
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>.
 
A

Aaron Gray

AFAICT FireFox SVG does not work with DOM Level 1 constructs, it needs
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.
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
 
M

Martin Honnen

Aaron said:
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
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.
 
V

VK

Aaron said:
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.html> and
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.
 
A

Aaron Gray

Martin Honnen said:
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.
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.
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
 
A

Aaron Gray

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
 
M

Martin Honnen

Aaron said:
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>
 
M

Martin Honnen

Aaron said:
<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 <script> which 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.
 
A

Aaron Gray

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,689
Members
48,796
Latest member
Greg L.

Latest Threads

Top