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