| 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 |
<!-- append child test --> |
| 25 |
<!-- --> |
| 26 |
<!-- @author [email protected] --> |
| 27 |
<!-- @version $Id$ --> |
| 28 |
<!-- ====================================================================== --> |
| 29 |
|
| 30 |
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> |
| 31 |
|
| 32 |
<svg xmlns="http://www.w3.org/2000/svg" |
| 33 |
xmlns:xlink="http://www.w3.org/1999/xlink" |
| 34 |
id="body" width="450" height="500" viewBox="0 0 450 500"> |
| 35 |
|
| 36 |
<title>appendChild test 'onload'</title> |
| 37 |
|
| 38 |
<text x="50%" y="45" class="title">appendChild test 'onload'</text> |
| 39 |
|
| 40 |
<script type="text/ecmascript"> |
| 41 |
|
| 42 |
var svgNamespaceURI = "http://www.w3.org/2000/svg"; |
| 43 |
|
| 44 |
function build(evt) { |
| 45 |
var g = evt.target; |
| 46 |
var document = g.ownerDocument; |
| 47 |
var e; |
| 48 |
|
| 49 |
e = createElement(document, 200, 100, "fill:crimson"); |
| 50 |
g.appendChild(e); |
| 51 |
|
| 52 |
e = createElement(document, 250, 100, "fill:orange"); |
| 53 |
g.appendChild(e); |
| 54 |
|
| 55 |
e = createElement(document, 150, 100, "fill:gold"); |
| 56 |
g.insertBefore(e, g.firstChild); |
| 57 |
|
| 58 |
var ee = createElement(document, 100, 100, "fill:#eee"); |
| 59 |
g.insertBefore(ee, e); |
| 60 |
} |
| 61 |
|
| 62 |
function createElement(g, x, y, style) { |
| 63 |
var e = document.createElementNS(svgNamespaceURI, "rect"); |
| 64 |
e.setAttribute("x", x); |
| 65 |
e.setAttribute("y", y); |
| 66 |
e.setAttribute("width", 100); |
| 67 |
e.setAttribute("height", 100); |
| 68 |
e.setAttribute("style", style); |
| 69 |
return e; |
| 70 |
} |
| 71 |
|
| 72 |
</script> |
| 73 |
|
| 74 |
<g onload="build(evt)" id="test-content"> |
| 75 |
</g> |
| 76 |
<text x="225" y="220" style="text-anchor:middle">constructed using 'onload'</text> |
| 77 |
<g> |
| 78 |
<rect x="100" y="300" width="100" height="100" style="fill:#eee"/> |
| 79 |
<rect x="150" y="300" width="100" height="100" style="fill:gold"/> |
| 80 |
<rect x="200" y="300" width="100" height="100" style="fill:crimson"/> |
| 81 |
<rect x="250" y="300" width="100" height="100" style="fill:orange"/> |
| 82 |
</g> |
| 83 |
<text x="225" y="420" style="text-anchor:middle">reference</text> |
| 84 |
</svg> |