struct-dom-06-b-isvalid.html (4079B)
1 <!DOCTYPE html> 2 <html lang='en'> 3 <head> 4 <title>struct-dom-06-b-manual.svg</title> 5 <meta charset='utf-8'> 6 </head> 7 <body> 8 <h1>Source SVG: struct-dom-06-b-manual.svg</h1> 9 <svg version="1.1" baseProfile="basic" onload="domTest(evt)" id="svg-root" 10 width="100%" height="100%" viewBox="0 0 480 360" 11 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> 12 <!--======================================================================--> 13 <!--= SVG 1.1 2nd Edition Test Case =--> 14 <!--======================================================================--> 15 <!--= Copyright 2009 World Wide Web Consortium, (Massachusetts =--> 16 <!--= Institute of Technology, European Research Consortium for =--> 17 <!--= Informatics and Mathematics (ERCIM), Keio University). =--> 18 <!--= All Rights Reserved. =--> 19 <!--= See http://www.w3.org/Consortium/Legal/. =--> 20 <!--======================================================================--> 21 22 <title id="test-title">$RCSfile: struct-dom-06-b.svg,v $</title> 23 <defs> 24 <font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> 25 <font-face-src> 26 <font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> 27 </font-face-src> 28 </font-face> 29 </defs> 30 <g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> 31 <script type="text/ecmascript"><![CDATA[ 32 33 function domTest(evt) { 34 // Get Document 35 var target = evt.target; 36 var doc = target.ownerDocument; 37 38 // 39 // Test attribute modification 40 // 41 var attributeErrorRect = doc.getElementById('attributeErrorRect'); 42 attributeErrorRect.setAttribute('width', '0') 43 attributeErrorRect.setAttribute('height', '0'); 44 45 // 46 // Test removing element from DOM tree 47 // 48 var elementErrorText = doc.getElementById('elementErrorText'); 49 var parent = elementErrorText.parentNode; 50 parent.removeChild(elementErrorText); 51 52 // 53 // Test adding element to the DOM tree 54 // 55 var svg_ns = "http://www.w3.org/2000/svg" 56 var newText = doc.createElementNS(svg_ns, 'text'); 57 newText.setAttribute('x', '50'); 58 newText.setAttribute('y', '200'); 59 var textContent = doc.createTextNode('DOM API is supported'); 60 newText.appendChild(textContent); 61 parent.appendChild(newText); 62 } 63 64 ]]></script> 65 <!-- ===================================================================== --> 66 <!-- The following rectangle's color is red. It is modified to zero size --> 67 <!-- in the 'domTest' ECMAScript handler. --> 68 <!-- ===================================================================== --> 69 <rect id="attributeErrorRect" width="450" height="450" fill="red"/> 70 <!-- ===================================================================== --> 71 <!-- The following text element is removed from the document in the --> 72 <!-- 'domTest' ECMAScript handler. --> 73 <!-- ===================================================================== --> 74 <text id="elementErrorText" x="50" y="200" font-family="Verdana" font-size="30" fill="black"> 75 Removing DOM Elements is not supported 76 </text> 77 </g> 78 <g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> 79 <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.8 $</text> 80 </g> 81 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> 82 <!-- comment out this watermark once the test is approved --> 83 <!--<g id="draft-watermark"> 84 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> 85 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" 86 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> 87 </g>--> 88 </svg> 89 </body> 90 </html>