Loading ...
Sorry, an error occurred while loading the content.

foreign objects in svg

Expand Messages
  • Olaf Schnabel
    Hi developers I want to implement foreign code in SVG. I tried it both as foreign object and as custom element as it is mentioned in the SVG spec. By clicking
    Message 1 of 3 , Jan 12, 2009
    • 0 Attachment
      Hi developers

      I want to implement foreign code in SVG. I tried it both as foreign
      object and as custom element as it is mentioned in the SVG spec. By
      clicking on the black rectangle, I want to get access to the foreign
      element with the JS function getElementById().

      Currently, the following example works only in ASV 3 and 6 but my
      students use Firefox 3 and Opera 9.6. How do I get this working?

      http://www.ika.ethz.ch/schnabel/foreign_object.svg

      Thanks for your help.
      Regards
      Olaf

      --
      Dr. Olaf Schnabel
      Institute of Cartography
      ETH Zurich
      Wolfgang-Pauli-Str. 15
      8093 Zurich
      Switzerland

      tel: ++41 44 633 3031
      fax: ++41 44 633 1153
      e-mail: oschnabel@...
      www private: http://www.ika.ethz.ch/schnabel
      www project: http://www.e-cartouche.ch
      www institute: http://www.karto.ethz.ch
    • Robert Longson
      ... You can t get the id of arbitrary XML using getElementById only things which are specified to have an attribute of type id and where the browser has
      Message 2 of 3 , Jan 12, 2009
      • 0 Attachment
        --- In svg-developers@yahoogroups.com, Olaf Schnabel <oschnabel@...>
        wrote:
        >
        > Hi developers
        >
        > I want to implement foreign code in SVG. I tried it both as foreign
        > object and as custom element as it is mentioned in the SVG spec. By
        > clicking on the black rectangle, I want to get access to the foreign
        > element with the JS function getElementById().

        You can't get the id of arbitrary XML using getElementById only things
        which are specified to have an attribute of type id and where the
        browser has implemented that specification. See the notes section of
        https://developer.mozilla.org/En/DOM:document.getElementById

        You could write your own version of getElementById to do what you want.

        Best regards

        Robert
      • Olaf Schnabel
        Thanks Robert I forgot this information. I used the function from Frank Bruder and now it works in all browsers:
        Message 3 of 3 , Jan 12, 2009
        • 0 Attachment
          Thanks Robert

          I forgot this information. I used the function from Frank Bruder and now
          it works in all browsers:
          http://www.ika.ethz.ch/schnabel/foreign_object.svg

          Thanks for the hint.
          Regards
          Olaf

          Robert Longson wrote:
          > You can't get the id of arbitrary XML using getElementById only things
          > which are specified to have an attribute of type id and where the
          > browser has implemented that specification. See the notes section of
          > https://developer.mozilla.org/En/DOM:document.getElementById
          > <https://developer.mozilla.org/En/DOM:document.getElementById>
          >
          > You could write your own version of getElementById to do what you want.
          >
          > Best regards
          > Robert

          --
          Dr. Olaf Schnabel
          Institute of Cartography
          ETH Zurich
          Wolfgang-Pauli-Str. 15
          8093 Zurich
          Switzerland

          tel: ++41 44 633 3031
          fax: ++41 44 633 1153
          e-mail: oschnabel@...
          www private: http://www.ika.ethz.ch/schnabel
          www project: http://www.e-cartouche.ch
          www institute: http://www.karto.ethz.ch
        Your message has been successfully submitted and would be delivered to recipients shortly.