| 12
 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
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 
 | <?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.
-->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>  
<svg xmlns="http://www.w3.org/2000/svg" 
     xmlns:xlink="http://www.w3.org/1999/xlink"
     xmlns:cb="http://www.example.org/gui/checkbox"
     id="body" width="450" height="500" viewBox="0 0 450 500">
  <title>Dynamic test of CSS selectors</title>
  <text x="50%" y="45" class="title">Dynamic test of CSS selectors</text>
  <style type="text/css"><![CDATA[
    text.button {
    fill: #00F;
    }
    text + text.button {
    fill: #888;
    }
    text + g > text {
      fill: #F00;
    }
    g > text {
      fill: #0F0;
    }
    g.xxx > text { fill: #F0F; }
    [id=test4] > text { fill: #80F; }
    g + [id=foo] > text { fill: #808; }
    .checkbox > path { fill: none; stroke: black; stroke-width: 2; }
    .checkbox > rect { fill: white; stroke: black; stroke-width: 1; }
    .checkbox[selected=true] > path { visibility: visible;}
    .checkbox[selected=false] > path { visibility: hidden; }
    .a { fill: red; }
    .b { fill: orange; }
    rect.a + .b { fill: blue; }
    ]]></style>
  <script type="text/ecmascript"><![CDATA[
    var svgns = "http://www.w3.org/2000/svg";
    function insertTextEvt(evt, x, y) {
       insertText(evt.currentTarget, x, y);
    }
    function removeTargetEvt(evt) {
       removeTarget(evt.currentTarget);
    }
    function setAttributeEvt(evt, attr, val) {
      evt.currentTarget.setAttribute(attr, val);
    }
    function removeTarget(e) {
       e.parentNode.removeChild(e);
    }
    function insertText(e, x, y) {
       var t = document.createElementNS(svgns, "text");
       t.setAttribute("x", x);
       t.setAttribute("y", y);
       t.appendChild(document.createTextNode("Inserted"));
       e.parentNode.insertBefore(t, e);
    }
    function toggleSelectedEvt(evt) {
      toggleSelected(evt.currentTarget);
    }
    function toggleSelected(e) {
       var sel = e.getAttribute("selected");
       if (sel == "true") {
         e.setAttribute("selected", "false");
       } else {
         e.setAttribute("selected", "true");
       }
    }
    function regardStart() {
      var e;
      removeTarget(document.getElementById("rm1"))
      insertText(document.getElementById("in1"), '10', '75');
      removeTarget(document.getElementById("rm2"))
      insertText(document.getElementById("in2"), '10', '125');
      document.getElementById("test3").setAttribute("class", "xxx");
      document.getElementById("test4").setAttribute("class", "");
      document.getElementById("test5").setAttribute("id", "foo");
      toggleSelected(document.getElementById("cb"));
      document.getElementById("a").setAttribute("class", "");
      regardTestInstance.scriptDone();
    }
  ]]></script>
  <g/>
  <text id="rm1" x="10" y="100" onclick="removeTargetEvt(evt)">Click me</text>
  <text x="100" y="100" class="button">Do I change?</text>
  <g/>
  <text id="in1" x="100" y="125" class="button" 
        onclick="insertTextEvt(evt, '10', '125')">Click Me!</text>
  <g/>
  <text id="rm2" x="10" y="150" onclick="removeTargetEvt(evt)">Click me</text>
  <g id="test1">
    <text id="ct" x="100" y="150">Child Text</text>
  </g>
  <g/>
  <g id="in2" onclick="insertTextEvt(evt, '10', '175')">
    <text id="ct2" x="100" y="175">Click me</text>
  </g>
  <g id="test3" onclick="setAttributeEvt(evt, 'class', 'xxx')">
    <text id="ct3" x="10" y="200">Click me</text>
  </g>
  <g id="test4" class="xxx" onclick="setAttributeEvt(evt, 'class', '')">
    <text id="ct4" x="100" y="200">Click me</text>
  </g>
  <g id="test5" class="xxx" onclick="setAttributeEvt(evt, 'id', 'foo')">
    <text id="ct5" x="200" y="200">Click me</text>
  </g>
  <g id="cb" class="checkbox" selected="true" transform="translate(10, 225)"
     onclick="toggleSelectedEvt(evt)">
    <rect width="15" height="15" fill="white" stroke="black"/>
    <path d="M3,3 L12,12 M12,3 L3,12"/>
  </g>
  <g fill="white" stroke="black">
    <rect id="a" class="a" x="10"  y="275" width="100" height="50"
      onclick="setAttributeEvt(evt, 'class', '')"/>
    <rect id="b" class="b" x="150" y="275" width="100" height="50"/>
    <g/>
    <text x="25" y="300" pointer-events="none" 
      style="fill: black; stroke: none">Click Me</text>
  </g>
</svg>
 |