If I use the .attr method to set attributes on elements I run into the
following problem when using it for SVG content. Most of the SVG IDLs
define properties as read-only although they are writable as DOM
attributes. In JQuery-1.2.6 the code for .attr has changed to use the
property mechanism (element [property]) for setting it if available.
Now, that does not work for the read-only IDLs of SVG; one could only
use the DOM interfaces (element.setAttribute (property, value)).

Is this a mistake in JQuery or am I supposed to use another way to set
the value of a property in SVG.

See below for a simple example. With Firefox I get an error on the
console saying I cannot set a value for which only a getter is
defined.

Any help or advise is much appreciated.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG
1.1//EN"
  "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd";>

<html xmlns="http://www.w3.org/1999/xhtml";>
  <head>
    <script src="jquery-1.2.6.js" />
    <script type="text/javascript">
        function test()
         {
           $('circle').attr("cx", "1");
         }
    </script>
    <title>
      Demo
    </title>

  </head>
  <body onload = "test();">
    <svg xmlns="http://www.w3.org/2000/svg"; xmlns:xlink="http://
www.w3.org/1999/xlink" version="1.1" baseProfile="full"
class="genericview" width="3000" height="3000">
      <circle cx="200px" cy="200px" r="150px" />
    </svg>
  </body>
</html>

Reply via email to