struct-dom-05-b-isvalid.html (4808B)
1 <!DOCTYPE html> 2 <html lang='en'> 3 <head> 4 <title>struct-dom-05-b-manual.svg</title> 5 <meta charset='utf-8'> 6 </head> 7 <body> 8 <h1>Source SVG: struct-dom-05-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-05-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 var featureStrings = new Array(); 34 var length = 0; 35 /* 36 featureStrings[length++] = "xml"; 37 featureStrings[length++] = "stylesheets"; 38 featureStrings[length++] = "views"; 39 featureStrings[length++] = "css2"; 40 featureStrings[length++] = "events"; 41 featureStrings[length++] = "uievents "; 42 featureStrings[length++] = "mouseevents"; 43 featureStrings[length++] = "mutationevents"; 44 featureStrings[length++] = "traversal"; 45 featureStrings[length++] = "org.w3c.svg"; 46 featureStrings[length++] = "org.w3c.svg.lang"; 47 featureStrings[length++] = "org.w3c.svg.dynamic"; 48 featureStrings[length++] = "org.w3c.svg.static"; 49 featureStrings[length++] = "org.w3c.dom.svg"; 50 featureStrings[length++] = "org.w3c.svg"; 51 */ 52 featureStrings[length++] = "org.w3c.dom.svg.static"; 53 featureStrings[length++] = "org.w3c.dom.svg.animation"; 54 featureStrings[length++] = "org.w3c.dom.svg.dynamic"; 55 featureStrings[length++] = "org.w3c.dom.svg.all"; 56 featureStrings[length++] = "org.w3c.svg.all"; 57 var svg_ns = "http://www.w3.org/2000/svg" 58 function domTest(evt) { 59 // Get Document 60 var target = evt.target; 61 var doc = target.ownerDocument; 62 63 // Get DOMImplementation 64 var domImpl = doc.implementation; 65 66 // 67 // Iterate through the feature strings 68 // 69 for(var i=0; i<featureStrings.length; i++){ 70 var supports = domImpl.hasFeature(featureStrings[i], '2.0'); 71 // 72 // if time, pretty up by putting xml to traveral in a left column and 73 // org.w3c.svg to org.w3c.dom.svg.all in a right column; add an extra 74 // parameter to addTextElemen t for x coord, and test if i < 9 75 // 76 addTextElement(featureStrings[i], supports, doc, doc.getElementById("test-body-content"), (45 + 40*i)); 77 } 78 } 79 80 function addTextElement(label, value, doc, svg, y){ 81 var newText = doc.createElementNS(svg_ns, 'text'); 82 newText.setAttribute('font-size', '30'); 83 newText.setAttribute('x', '5'); 84 newText.setAttribute('y', y); 85 var textValue = label; 86 var textContent = doc.createTextNode(textValue); 87 newText.appendChild(textContent); 88 svg.appendChild(newText); 89 90 newText = doc.createElementNS(svg_ns, 'text'); 91 newText.setAttribute('font-size', '30'); 92 newText.setAttribute('x', '385'); 93 newText.setAttribute('y', y); 94 textValue = value; 95 textContent = doc.createTextNode(textValue); 96 newText.appendChild(textContent); 97 svg.appendChild(newText); 98 } 99 100 ]]></script> 101 </g> 102 <g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> 103 <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.7 $</text> 104 </g> 105 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> 106 <!-- comment out this watermark once the test is approved --> 107 <!--<g id="draft-watermark"> 108 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> 109 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" 110 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> 111 </g>--> 112 </svg> 113 </body> 114 </html>