| 1 |
<?xml version="1.0" standalone="no"?> |
| 2 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" |
| 3 |
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> |
| 4 |
|
| 5 |
<!-- |
| 6 |
|
| 7 |
Licensed to the Apache Software Foundation (ASF) under one or more |
| 8 |
contributor license agreements. See the NOTICE file distributed with |
| 9 |
this work for additional information regarding copyright ownership. |
| 10 |
The ASF licenses this file to You under the Apache License, Version 2.0 |
| 11 |
(the "License"); you may not use this file except in compliance with |
| 12 |
the License. You may obtain a copy of the License at |
| 13 |
|
| 14 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 15 |
|
| 16 |
Unless required by applicable law or agreed to in writing, software |
| 17 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 18 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 |
See the License for the specific language governing permissions and |
| 20 |
limitations under the License. |
| 21 |
|
| 22 |
--> |
| 23 |
<!-- ====================================================================== --> |
| 24 |
<!-- Test of adding/removing event attributes --> |
| 25 |
<!-- --> |
| 26 |
<!-- @author [email protected] --> |
| 27 |
<!-- @version $Id$ --> |
| 28 |
<!-- ====================================================================== --> |
| 29 |
|
| 30 |
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> |
| 31 |
|
| 32 |
|
| 33 |
<svg id="body" width="450" height="500" viewBox="0 0 450 500" |
| 34 |
xmlns="http://www.w3.org/2000/svg" |
| 35 |
xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 36 |
|
| 37 |
<script language="text/ecmascript"><![CDATA[ |
| 38 |
var root = document.getRootElement(); |
| 39 |
|
| 40 |
function adjust1 () { |
| 41 |
// Ensure we can add event attr. |
| 42 |
root.setAttributeNS(null, "onzoom", "setRect('a', 'lightblue')"); |
| 43 |
root.currentScale = 1.1; |
| 44 |
setTimeout(adjust2, 500); |
| 45 |
} |
| 46 |
|
| 47 |
function adjust2() { |
| 48 |
// Ensure we can modify event attr. |
| 49 |
root.setAttributeNS(null, "onzoom", "setRect('b', 'lightblue')"); |
| 50 |
root.currentScale = 1.0; |
| 51 |
setTimeout(adjust3, 500); |
| 52 |
} |
| 53 |
|
| 54 |
function adjust3() { |
| 55 |
// Part 1 ensure we can remove event attr. |
| 56 |
root.setAttributeNS(null, "onzoom", "setRect('c', 'lightblue')"); |
| 57 |
root.currentScale = 1.1; |
| 58 |
setTimeout(adjust4, 500); |
| 59 |
} |
| 60 |
|
| 61 |
function adjust4() { |
| 62 |
// Part 2 ensure we can remove event attr. |
| 63 |
root.removeAttributeNS(null, "onzoom"); |
| 64 |
setRect('c', 'gold'); // It should stay gold. |
| 65 |
root.currentScale = 1.0; |
| 66 |
if (inRegard) { |
| 67 |
setTimeout(done, 500); |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
function done() { |
| 72 |
regardTestInstance.scriptDone(); |
| 73 |
} |
| 74 |
|
| 75 |
function setRect(id, color) { |
| 76 |
var elem = document.getElementById(id); |
| 77 |
elem.setAttributeNS(null, "fill", color); |
| 78 |
} |
| 79 |
|
| 80 |
var inRegard = false; |
| 81 |
function regardStart() { |
| 82 |
inRegard = true; |
| 83 |
adjust1(); |
| 84 |
} |
| 85 |
]]></script> |
| 86 |
|
| 87 |
<title>Addtion/Modification/Removal of event attributes.</title> |
| 88 |
<text class="title" x="50%" y="40" text-anchor="middle" |
| 89 |
>Addtion/Modification/Removal of event attributes.</text> |
| 90 |
<text x="50%" y="55" text-anchor="middle" |
| 91 |
>Click Rect to start test</text> |
| 92 |
|
| 93 |
<g id="test-content" onclick="adjust1()" text-anchor="middle"> |
| 94 |
<rect id="a" x="50" y="100" width="250" height="50" fill="crimson"/> |
| 95 |
<rect x="310" y="100" width="25" height="50" fill="lightblue"/> |
| 96 |
<text x="175" y="130">Event Attr Add</text> |
| 97 |
|
| 98 |
<rect id="b" x="50" y="175" width="250" height="50" fill="crimson"/> |
| 99 |
<rect x="310" y="175" width="25" height="50" fill="lightblue"/> |
| 100 |
<text x="175" y="205">Event Attr Modify</text> |
| 101 |
|
| 102 |
<rect id="c" x="50" y="250" width="250" height="50" fill="crimson"/> |
| 103 |
<rect x="310" y="250" width="25" height="50" fill="gold"/> |
| 104 |
<text x="175" y="285">Event Attr Remove</text> |
| 105 |
|
| 106 |
</g> |
| 107 |
|
| 108 |
</svg> |