FF SVG and DOM Level 1

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aaron Gray

    FF SVG and DOM Level 1

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

    Is this correct ?

    Aaron


  • Martin Honnen

    #2
    Re: FF SVG and DOM Level 1

    Aaron Gray wrote:
    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.create ElementNS,
    getElementsByTa gNameNS, 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

    Comment

    • Aaron Gray

      #3
      Re: FF SVG and DOM Level 1

      >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.

      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.create ElementNS,
      getElementsByTa gNameNS, 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


      Comment

      • Martin Honnen

        #4
        Re: FF SVG and DOM Level 1

        Aaron Gray wrote:
        >>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>

        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

        Comment

        • VK

          #5
          Re: FF SVG and DOM Level 1

          Aaron Gray wrote:
          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.htm land
          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.

          Comment

          • Aaron Gray

            #6
            Re: FF SVG and DOM Level 1

            "Martin Honnen" <mahotrash@yaho o.dewrote in message
            news:458beb81$0 $18834$9b4e6d93 @newsspool4.arc or-online.net...
            Aaron Gray wrote:
            >>>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.
            >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.
            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



            Comment

            • Aaron Gray

              #7
              Re: FF SVG and DOM Level 1

              <http://www.lutanho.net/svgvml3d/index.html>. This also will show you
              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, "createElem ent( 'v:group')" rather than a
              DOM Level 2, "createElementN S( ns, tag)".

              Great. Too obvious.

              Thanks for the link,

              Aaron



              Comment

              • Martin Honnen

                #8
                Re: FF SVG and DOM Level 1

                Aaron Gray wrote:
                ><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

                Comment

                • Aaron Gray

                  #9
                  Re: FF SVG and DOM Level 1

                  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>
                  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 :-



                  Many thanks for your help,

                  Aaron



                  Comment

                  • Martin Honnen

                    #10
                    Re: FF SVG and DOM Level 1

                    Aaron Gray wrote:
                    <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

                    Comment

                    • Aaron Gray

                      #11
                      Re: FF SVG and DOM Level 1

                      > <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.
                      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




                      Comment

                      Working...