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 <!-- ===================================================================== -->
10 <!-- dom-featureString-BE-03.svg -->
11 <!-- renamed for 1.1 suite to struct-dom-04-b -->
12 <!-- Author : Vincent Hardy 06-08-2000 -->
13 <!-- Revised for 1.1 : Chris Lilley, 15-Mar-2002 -->
14 <!-- Revised for 1.1 : Darryl Fuller, 27-Jun-2002 -->
15 <!--======================================================================-->
16 <svg version=
"1.1" baseProfile=
"tiny" 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)">
17 <SVGTestCase xmlns=
"http://www.w3.org/2000/02/svg/testsuite/description/">
18 <OperatorScript version=
"$Revision: 1.1 $" testname=
"struct-dom-04-b.svg">
19 <Paragraph>Verify the basic capability to handle the hasFeature DOMImplementation method.
20 The DOMImplementation instance is retreived from the Document instance. Then,
21 its hasFeature method is invoked on the various SVG feature strings.
23 <Paragraph>The test displays the set of SVG feature strings and, next to them, a text
24 string that shows whether the feature is supported or not.
26 <Paragraph>Note that the test passes whether or not the feature is supported (i.e., true or
27 false are valid). The test fails if no value (true or false) appears next to the feature string
30 <Paragraph>Note that this test uses the 'onload' event on the root svg element.
32 <Paragraph>The rendered picture should match the reference image, except for the yes and
33 no values which may differ depending on the implementation.
37 <title id=
"test-title">struct-dom-
04-b
</title>
38 <desc id=
"test-desc">Checks if DOM/ECMA Script binding is supported. Checks support for the
39 hasFeature method on the DOMImplementation.
41 <!--======================================================================-->
42 <!--Content of Test Case follows... =====================-->
43 <!--======================================================================-->
44 <g id=
"test-body-content">
45 <script type=
"text/ecmascript"><![CDATA[
47 var featureStrings = new Array();
50 featureStrings[length++] =
"xml";
51 featureStrings[length++] =
"stylesheets";
52 featureStrings[length++] =
"views";
53 featureStrings[length++] =
"css2";
54 featureStrings[length++] =
"events";
55 featureStrings[length++] =
"uievents ";
56 featureStrings[length++] =
"mouseevents";
57 featureStrings[length++] =
"mutationevents";
58 featureStrings[length++] =
"traversal";
59 featureStrings[length++] =
"org.w3c.svg";
61 featureStrings[length++] =
"org.w3c.svg.lang";
62 featureStrings[length++] =
"org.w3c.svg.dynamic";
63 featureStrings[length++] =
"org.w3c.svg.static";
64 featureStrings[length++] =
"org.w3c.dom.svg";
65 featureStrings[length++] =
"org.w3c.svg";
67 featureStrings[length++] =
"org.w3c.dom.svg.static";
68 featureStrings[length++] =
"org.w3c.dom.svg.animation";
69 featureStrings[length++] =
"org.w3c.dom.svg.dynamic";
70 featureStrings[length++] =
"org.w3c.svg.all";
71 featureStrings[length++] =
"org.w3c.dom.svg.all";
73 var svg_ns =
"http://www.w3.org/2000/svg"
74 function domTest(evt) {
76 var target = evt.target;
77 var doc = target.ownerDocument;
79 // Get DOMImplementation
80 var domImpl = doc.implementation;
83 // Iterate through the feature strings
85 for(var i=
0; i
<featureStrings.length; i++){
86 var supports = domImpl.hasFeature(featureStrings[i], '
2.0');
88 // if time, pretty up by putting xml to traveral in a left column and
89 // org.w3c.svg to org.w3c.dom.svg.all in a right column; add an extra
90 // parameter to addTextElemen t for x coord, and test if i
< 9
92 addTextElement(featureStrings[i], supports, doc, target, (
45 +
40*i));
96 function addTextElement(label, value, doc, svg, y){
97 var newText = doc.createElementNS(svg_ns, 'text');
98 newText.setAttribute('font-size', '
30');
99 newText.setAttribute('x', '
5');
100 newText.setAttribute('y', y);
101 var textValue = label;
102 var textContent = doc.createTextNode(textValue);
103 newText.appendChild(textContent);
104 svg.appendChild(newText);
106 newText = doc.createElementNS(svg_ns, 'text');
107 newText.setAttribute('font-size', '
30');
108 newText.setAttribute('x', '
385');
109 newText.setAttribute('y', y);
111 textContent = doc.createTextNode(textValue);
112 newText.appendChild(textContent);
113 svg.appendChild(newText);
118 <text id=
"revision" x=
"10" y=
"340" font-size=
"30" stroke=
"none" fill=
"black">$Revision:
1.1 $
</text>
119 <rect id=
"test-frame" x=
"1" y=
"1" width=
"478" height=
"358" fill=
"none" stroke=
"#000000"/>