Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
1.7
-
None
-
None
-
Operating System: other
Platform: Other
Description
In order to move an element to the "top", I use the following script, which
removes an element from its parent, and inserts it as the last child of the root
element (thereby ensuring it gets draw last).
function raise(e) {
if
(document.documentElement.childNodes.item(document.documentElement.childNodes.length-1)
!= e)
However, if the element in question has a SET sub-element, something in the
event processing gets confused, and each subsequent event causes a
NullPointerException like this:
[java] at
org.apache.batik.anim.timing.TimedElement.eventOccurred(Unknown Source)
[java] at
org.apache.batik.anim.timing.EventbaseTimingSpecifier.handleEvent(Unknown Source)
[java] at
org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source)
[java] at
org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source)
[java] at
org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)
[java] at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)
[java] at
org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown
Source)
[java] at
org.apache.batik.bridge.BridgeEventSupport$Listener.mouseEntered(Unknown Source)
[java] at
org.apache.batik.gvt.event.AbstractAWTEventDispatcher.processMouseEvent(Unknown
Source)
[java] at
org.apache.batik.gvt.event.AbstractAWTEventDispatcher.dispatchMouseEvent(Unknown
Source)
[java] at
org.apache.batik.gvt.event.AbstractAWTEventDispatcher.dispatchEvent(Unknown Source)
[java] at
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(Unknown Source)
[java] at
org.apache.batik.gvt.event.AbstractAWTEventDispatcher.mouseMoved(Unknown Source)
[java] at
org.apache.batik.swing.svg.AbstractJSVGComponent$SVGListener$1MouseMovedRunnable.run(Unknown
Source)
[java] at org.apache.batik.util.RunnableQueue.run(Unknown Source)
[java] at java.lang.Thread.run(Thread.java:595)
The following SVG demonstrates the effect: click the rectangle to trigger the
raise function, and then observe the exceptions:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sbthd="http://www.selvaag.no/2007/sbthd" viewBox="-0.50 -1.00 11.00 22.00"
font-family="Verdana" font-size="50.0">
<title>
House Designer SVG Output
</title>
<defs>
<script type="text/ecmascript">
<![CDATA[function raise(e) {
if
(document.documentElement.childNodes.item(document.documentElement.childNodes.length-1)
!= e) { e.parentNode.removeChild(e); document.documentElement.appendChild(e); }
}]]>
</script>
</defs>
<rect x="0.0" y="0.0" width="10.0" height="20.0" fill="blue" opacity="0.9"
stroke="black" stroke-width="1.0" onclick="raise(evt.target)">
<set attributeName="stroke-width" to="5.0" begin="mouseover" end="mouseout" />
</rect>
</svg>