Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-296

DOM access functions should return ECMAScript strings.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Fixed
    • 1.5
    • None
    • Scripting
    • None
    • Operating System: All
      Platform: All

    Description

      Wouldn't it be better to get an ECMAScript string when accessing the value of
      an attribute in the DOM tree? When executing the following svg code in Batik
      (1.5beta3) the alert window does not display the length of the string as a
      number (but some script-code-string).

      Instead workarounds like

      var str = textNode.getAttribute("id") + '';
      var str = String(textNode.getAttribute("id"));

      have to be used.

      --------------------------------------------------------------

      <?xml version="1.0" encoding="iso-8859-1"?>

      <svg width="300" height="200">

      <script type="text/ecmascript"> <![CDATA[

      function showId()

      { var textNode = document.getElementById("TestString"); var str = textNode.getAttribute("id"); var strLen = str.length; alert("string: " + str + " length: " + strLen); }

      ]]> </script>

      <a onclick="showId()">
      <text id="TestString" x="70" y="100" font-size="40">Click me.</text>
      </a>

      </svg>

      Attachments

        Activity

          People

            batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
            martin.barbisch@gmx.de Martin Barbisch
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: