1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE svg PUBLIC
"-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
3 <!--======================================================================-->
4 <!--= Copyright 2000 World Wide Web Consortium, (Massachusetts =-->
5 <!--= Institute of Technology, Institut National de Recherche en =-->
6 <!--= Informatique et en Automatique, Keio University). All Rights =-->
7 <!--= Reserved. See http://www.w3.org/Consortium/Legal/. =-->
8 <!--======================================================================-->
9 <!-- =====================================================================-->
11 <!-- dom-core-BE-01.svg -->
12 <!-- renamed for 1.1 suite to struct-dom-06-b -->
13 <!-- Author : Vincent Hardy 06-08-2000 -->
14 <!-- Revised for 1.1 : Chris Lilley, 15-Mar-2002 -->
15 <!-- Revised for Mobile Profiles: Jun Fujisawa 16-Jul-2002 -->
16 <!--======================================================================-->
17 <svg version=
"1.1" baseProfile=
"basic" xmlns=
"http://www.w3.org/2000/svg" xmlns:
xlink=
"http://www.w3.org/1999/xlink" id=
"svg-root" width=
"100%" height=
"100%" viewBox=
"0 0 480 360" onload=
"domTest(evt)">
18 <SVGTestCase xmlns=
"http://www.w3.org/2000/02/svg/testsuite/description/">
19 <OperatorScript version=
"$Revision: 1.3 $" testname=
"struct-dom-06-b.svg">
20 <Paragraph>Verify the basic capability to handle the DOM API. The test is composed of a top
21 level svg element with an onload event handler. This handler invokes core (i.e., non
22 SVG specific) DOM API methods to modify the document's content: it removes an element,
23 modifies an attribute and adds elements.
25 <Paragraph>If an implementation supports the ECMA Script DOM binding, then the image
26 should show the following text:
"The DOM API is supported". Otherwise, the following
27 will show:
"Removing DOM elements is not supported", and the background will be red.
29 <Paragraph>The rendered picture should match the reference image.
33 <title id=
"test-title">struct-dom-
06-b
</title>
34 <desc id=
"test-desc">Checks if DOM ECMA Script binding is supported
</desc>
35 <!--======================================================================-->
36 <!--Content of Test Case follows... =====================-->
37 <!--======================================================================-->
38 <g id=
"test-body-content">
39 <script type=
"text/ecmascript"><![CDATA[
41 function domTest(evt) {
43 var target = evt.target;
44 var doc = target.ownerDocument;
47 // Test attribute modification
49 var attributeErrorRect = doc.getElementById('attributeErrorRect');
50 attributeErrorRect.setAttribute('width', '
0')
51 attributeErrorRect.setAttribute('height', '
0');
54 // Test removing element from DOM tree
56 var elementErrorText = doc.getElementById('elementErrorText');
57 var parent = elementErrorText.parentNode;
58 parent.removeChild(elementErrorText);
61 // Test adding element to the DOM tree
63 var svg_ns =
"http://www.w3.org/2000/svg"
64 var newText = doc.createElementNS(svg_ns, 'text');
65 newText.setAttribute('x', '
50');
66 newText.setAttribute('y', '
200');
67 var textContent = doc.createTextNode('DOM API is supported');
68 newText.appendChild(textContent);
69 parent.appendChild(newText);
73 <!-- ===================================================================== -->
74 <!-- The following rectangle's color is red. It is modified to zero size -->
75 <!-- in the 'domTest' ECMA Script handler. -->
76 <!-- ===================================================================== -->
77 <rect id=
"attributeErrorRect" width=
"450" height=
"450" fill=
"red"/>
78 <!-- ===================================================================== -->
79 <!-- The following text element is removed from the document in the -->
80 <!-- 'tomTest' ECMA Script handler. -->
81 <!-- ===================================================================== -->
82 <text id=
"elementErrorText" x=
"50" y=
"200" font-family=
"Verdana" font-size=
"30" fill=
"black">
83 Removing DOM Elements is not supported
86 <text id=
"revision" x=
"10" y=
"340" font-size=
"30" stroke=
"none" fill=
"black">$Revision:
1.3 $
</text>
87 <rect id=
"test-frame" x=
"1" y=
"1" width=
"478" height=
"358" fill=
"none" stroke=
"#000000"/>