blob: 03790ce7253d4bbd6c270e94d303c69e8f00b33c [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
<!--======================================================================-->
<!--= Copyright 2000 World Wide Web Consortium, (Massachusetts =-->
<!--= Institute of Technology, Institut National de Recherche en =-->
<!--= Informatique et en Automatique, Keio University). All Rights =-->
<!--= Reserved. See http://www.w3.org/Consortium/Legal/. =-->
<!--======================================================================-->
<!-- =====================================================================-->
<!-- -->
<!-- dom-core-BE-01.svg -->
<!-- renamed for 1.1 suite to struct-dom-06-b -->
<!-- Author : Vincent Hardy 06-08-2000 -->
<!-- Revised for 1.1 : Chris Lilley, 15-Mar-2002 -->
<!-- Revised for Mobile Profiles: Jun Fujisawa 16-Jul-2002 -->
<!--======================================================================-->
<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)">
<SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testsuite/description/">
<OperatorScript version="$Revision: 1.3 $" testname="struct-dom-06-b.svg">
<Paragraph>Verify the basic capability to handle the DOM API. The test is composed of a top
level svg element with an onload event handler. This handler invokes core (i.e., non
SVG specific) DOM API methods to modify the document's content: it removes an element,
modifies an attribute and adds elements.
</Paragraph>
<Paragraph>If an implementation supports the ECMA Script DOM binding, then the image
should show the following text: "The DOM API is supported". Otherwise, the following
will show: "Removing DOM elements is not supported", and the background will be red.
</Paragraph>
<Paragraph>The rendered picture should match the reference image.
</Paragraph>
</OperatorScript>
</SVGTestCase>
<title id="test-title">struct-dom-06-b</title>
<desc id="test-desc">Checks if DOM ECMA Script binding is supported</desc>
<!--======================================================================-->
<!--Content of Test Case follows... =====================-->
<!--======================================================================-->
<g id="test-body-content">
<script type="text/ecmascript"><![CDATA[
function domTest(evt) {
// Get Document
var target = evt.target;
var doc = target.ownerDocument;
//
// Test attribute modification
//
var attributeErrorRect = doc.getElementById('attributeErrorRect');
attributeErrorRect.setAttribute('width', '0')
attributeErrorRect.setAttribute('height', '0');
//
// Test removing element from DOM tree
//
var elementErrorText = doc.getElementById('elementErrorText');
var parent = elementErrorText.parentNode;
parent.removeChild(elementErrorText);
//
// Test adding element to the DOM tree
//
var svg_ns = "http://www.w3.org/2000/svg"
var newText = doc.createElementNS(svg_ns, 'text');
newText.setAttribute('x', '50');
newText.setAttribute('y', '200');
var textContent = doc.createTextNode('DOM API is supported');
newText.appendChild(textContent);
parent.appendChild(newText);
}
]]></script>
<!-- ===================================================================== -->
<!-- The following rectangle's color is red. It is modified to zero size -->
<!-- in the 'domTest' ECMA Script handler. -->
<!-- ===================================================================== -->
<rect id="attributeErrorRect" width="450" height="450" fill="red"/>
<!-- ===================================================================== -->
<!-- The following text element is removed from the document in the -->
<!-- 'tomTest' ECMA Script handler. -->
<!-- ===================================================================== -->
<text id="elementErrorText" x="50" y="200" font-family="Verdana" font-size="30" fill="black">
Removing DOM Elements is not supported
</text>
</g>
<text id="revision" x="10" y="340" font-size="30" stroke="none" fill="black">$Revision: 1.3 $</text>
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
</svg>