| 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 |
<!-- Testing calls to CSSStlyeDeclaration.setProperty --> |
| 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 |
xmlns="http://www.w3.org/2000/svg" |
| 34 |
xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 35 |
<title>Testing CSS DOM with setProperty.</title> |
| 36 |
|
| 37 |
|
| 38 |
<script><![CDATA[ |
| 39 |
function regardStart(){ |
| 40 |
setTimeout("test()", 20); |
| 41 |
} |
| 42 |
function test() { |
| 43 |
var e, style; |
| 44 |
|
| 45 |
e = document.getElementById("r1"); |
| 46 |
style = e.getStyle(); |
| 47 |
style.setProperty("fill","url(#lg)",""); |
| 48 |
|
| 49 |
e = document.getElementById("r2"); |
| 50 |
style = e.getStyle(); |
| 51 |
var paint = style.getPropertyCSSValue("fill"); |
| 52 |
paint.setPaint(SVGPaint.SVG_PAINTTYPE_URI, "#lg", "", ""); |
| 53 |
if (paint.getPaintType() != SVGPaint.SVG_PAINTTYPE_URI) |
| 54 |
throw ("Wrong paint type: " + paint.getPaintType()); |
| 55 |
if (regardTestInstance != null) |
| 56 |
regardTestInstance.scriptDone(); |
| 57 |
} |
| 58 |
]]></script> |
| 59 |
|
| 60 |
<linearGradient id="lg" x1="25%" x2="75%" y1="75%" y2="25%"> |
| 61 |
<stop offset=".0" stop-color="gold" /> |
| 62 |
<stop offset="1" stop-color="crimson" /> |
| 63 |
</linearGradient> |
| 64 |
|
| 65 |
|
| 66 |
<g> |
| 67 |
<title>Setting CSS properties through CSS DOM</title> |
| 68 |
<text class="title" x="50%" y="40" |
| 69 |
>Setting CSS properties through CSS DOM</text> |
| 70 |
|
| 71 |
|
| 72 |
<rect id="r1" x="10" y="150" width="100" height="50" fill="green"/> |
| 73 |
<rect id="r2" x="120" y="150" width="100" height="50" |
| 74 |
style="fill:purple"/> |
| 75 |
</g> |
| 76 |
</svg> |
| 77 |
|