| 1 |
<?xml version="1.0" standalone="no"?> |
| 2 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN" |
| 3 |
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.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 |
<!-- Modification of tspan children --> |
| 25 |
<!-- --> |
| 26 |
<!-- @author [email protected] --> |
| 27 |
<!-- @version $Id$ --> |
| 28 |
<!-- ====================================================================== --> |
| 29 |
|
| 30 |
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> |
| 31 |
|
| 32 |
<svg id="body" width="450" height="500" viewBox="0 0 450 500"> |
| 33 |
<title><tspan> children updates 'onload'</title> |
| 34 |
|
| 35 |
<text x="50%" y="45" class="title"><tspan> children in 'onload'</text> |
| 36 |
|
| 37 |
<script type="text/ecmascript"> |
| 38 |
|
| 39 |
function text_append(evt, text) { |
| 40 |
var elt = evt.target; |
| 41 |
var textNode = elt.getFirstChild(); |
| 42 |
|
| 43 |
textNode.appendData(text); |
| 44 |
} |
| 45 |
function text_delete(evt, offset, count) { |
| 46 |
var elt = evt.target; |
| 47 |
var textNode = elt.getFirstChild(); |
| 48 |
|
| 49 |
textNode.deleteData(offset,count); |
| 50 |
} |
| 51 |
function text_insert(evt, offset, text) { |
| 52 |
var elt = evt.target; |
| 53 |
var textNode = elt.getFirstChild(); |
| 54 |
|
| 55 |
textNode.insertData(offset,text); |
| 56 |
} |
| 57 |
function text_replace(evt, offset,count,text) { |
| 58 |
var elt = evt.target; |
| 59 |
var textNode = elt.getFirstChild(); |
| 60 |
|
| 61 |
textNode.replaceData(offset,count,text); |
| 62 |
} |
| 63 |
|
| 64 |
</script> |
| 65 |
|
| 66 |
<g id="test-content"> |
| 67 |
<g style="text-anchor:middle;font-size:24;stroke:none;fill:crimson" > |
| 68 |
|
| 69 |
<text x="100" y="155" dy="0 -2 5 -5 5 -5 5 -5 5 -5 5 -5 5 -2" |
| 70 |
xml:space="preserve" ><tspan onload="text_append(evt,' the end')" >append at</tspan></text> |
| 71 |
<text x="100" y="355" dy="0 -2 5 -5 5 -5 5 -5 5 -2" |
| 72 |
xml:space="preserve" ><tspan onload="text_delete(evt,7,4)" >delete any words</tspan></text> |
| 73 |
<text x="325" y="155" dy="0 -2 5 -5 5 -5 5 -5 5 -5 5 -5 5 -2" |
| 74 |
xml:space="preserve" ><tspan onload="text_insert(evt,6,' between')" >insert words</tspan></text> |
| 75 |
<text x="325" y="355" dy="0 -2 5 -5 5 -5 5 -5 5 -5 5 -5 5 -2" |
| 76 |
xml:space="preserve" ><tspan onload="text_replace(evt,10,8,'string')" >replace a sentence</tspan></text> |
| 77 |
|
| 78 |
</g> |
| 79 |
|
| 80 |
<g style="stroke:black; fill:none; stroke-width:1 ;text-anchor:middle; font-size:24"> |
| 81 |
<text x="100" y="155" dy="0 -2 5 -5 5 -5 5 -5 5 -5 5 -5 5 -2" |
| 82 |
><tspan>append at the end</tspan></text> |
| 83 |
<text x="100" y="355" dy="0 -2 5 -5 5 -5 5 -5 5 -2" |
| 84 |
><tspan>delete words</tspan></text> |
| 85 |
<text x="325" y="155" dy="0 -2 5 -5 5 -5 5 -5 5 -5 5 -5 5 -2" |
| 86 |
><tspan>insert between words</tspan></text> |
| 87 |
<text x="325" y="355" dy="0 -2 5 -5 5 -5 5 -5 5 -5 5 -5 5 -2" |
| 88 |
><tspan>replace a string</tspan></text> |
| 89 |
</g> |
| 90 |
|
| 91 |
<g style="fill:black; stroke:none; text-anchor:middle"> |
| 92 |
<text x="100" y="230" >TEXT_NODE.append</text> |
| 93 |
<text x="100" y="430" >TEXT_NODE.delete</text> |
| 94 |
<text x="325" y="230" >TEXT_NODE.insert</text> |
| 95 |
<text x="325" y="430" >TEXT_NODE.replace</text> |
| 96 |
</g> |
| 97 |
</g> |
| 98 |
</svg> |