Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
1.5
-
None
-
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>