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