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

SVG 1.2 and ECMAScript implementation

Expand Messages
  • Bjoern Hoehrmann
    Hi, I made a quick implementation of the and elements as proposed for SVG Tiny 1.2 to the extend allowed by the not so good Working
    Message 1 of 1 , Dec 20, 2005
      Hi,

      I made a quick implementation of the <svg:handler> and <ev:listener>
      elements as proposed for SVG Tiny 1.2 to the extend allowed by the not
      so good Working Draft <http://www.w3.org/TR/SVGMobile12/script.html>...
      A simple example would be

      <!DOCTYPE svg [ <!ATTLIST handler id ID #IMPLIED> ]>
      <svg
      xmlns = "http://www.w3.org/2000/svg"
      xmlns:xlink = 'http://www.w3.org/1999/xlink'
      xmlns:ev = "http://www.w3.org/2001/xml-events"
      >
      <defs>
      <handler id="test">
      evt.target.setAttributeNS(null, 'fill', 'green');
      </handler>
      </defs>

      <rect id="obs1" height="100" width="100" x="0"/>
      <a xlink:href="http://www.w3.org">
      <rect id="obs2" height="100" width="100" x="100"/>
      </a>
      <rect id="obs3" height="100" width="100" x="200"/>

      <ev:listener observer="#obs1" event="click" handler='#test' />
      <ev:listener observer="#obs2" event="click" defaultAction='cancel' />
      <ev:listener observer="#obs3" event="click" handler='#test' />
      </svg>

      This is at http://www.bjoernsworld.de/temp/xml-events-01.svg which uses
      http://www.bjoernsworld.de/temp/svg+xml-events.es to enable use of these
      elements in non-compliant SVG 1.0/1.1 viewers like Opera9, Firefox 1.5
      and ASV6. In compliant viewers like Batik it won't work (unless you use
      only the ev:listener element).

      There is some code to handle mutations of the elements and the document
      (including listener registration during progressive download) but it
      turns out that there are too many problems with existing implementations
      and specifications that this is not really feasible, so some of the code
      is missing and/or not used as intended.

      The code also has an implementation of the DOM Level 3 Core Node method
      lookupNamespaceURI if you are into namespaces that might be of interest.
      The code is available under the GPL and might eventually end up in the
      SVG QA project <http://sf.net/projects/svg-qa>. I am not likely to main-
      tain this code, if you'd like to, please drop me a mail.

      regards,
      --
      Björn Höhrmann · mailto:bjoern@... · http://bjoern.hoehrmann.de
      Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
      68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
    Your message has been successfully submitted and would be delivered to recipients shortly.