| <?xml version="1.0" standalone="no"?> |
| <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" |
| "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> |
| |
| <!-- ========================================================================= --> |
| <!-- Copyright (C) The Apache Software Foundation. All rights reserved. --> |
| <!-- --> |
| <!-- This software is published under the terms of the Apache Software License --> |
| <!-- version 1.1, a copy of which has been included with this distribution in --> |
| <!-- the LICENSE file. --> |
| <!-- ========================================================================= --> |
| |
| <!-- ========================================================================= --> |
| <!-- Checks the operation of the Rhino eval function. --> |
| <!-- --> |
| <!-- @author vincent.hardy@sun.com --> |
| <!-- @version $Id$ --> |
| <!-- ========================================================================= --> |
| |
| <svg xmlns="http://www.w3.org/2000/svg" |
| xmlns:xlink="http://www.w3.org/1999/xlink" |
| xmlns:test="http://xml.apache.org/batik/test" |
| width="450" height="500" viewBox="0 0 450 500" |
| onload="checkEval()"> |
| |
| <test:testResult id="testResult" result="failed" errorCode="evalCode not evaluated"/> |
| |
| <script type="text/ecmascript"><![CDATA[ |
| function checkEval(){ |
| var e = document.getElementById('target'); |
| var ecmaCode = e.getAttributeNS("http://some.company.com/", "eval"); |
| alert("About to evaluate: " + ecmaCode); |
| eval(ecmaCode); |
| } |
| |
| function callMe() { |
| alert("in callMe()"); |
| var e = document.getElementById("testResult"); |
| e.setAttributeNS(null, "result", "passed"); |
| } |
| |
| ]]></script> |
| |
| <rect width="100%" height="100%" id="target" xmlns:data="http://some.company.com/" |
| data:eval="callMe()" |
| onclick="checkEval()"/> |
| |
| </svg> |