interact-dom-01-b-isvalid.html (4357B)
1 <!DOCTYPE html> 2 <html lang='en'> 3 <head> 4 <title>interact-dom-01-b-manual.svg</title> 5 <meta charset='utf-8'> 6 </head> 7 <body> 8 <h1>Source SVG: interact-dom-01-b-manual.svg</h1> 9 <svg version="1.1" baseProfile="basic" id="svg-root" 10 width="100%" height="100%" viewBox="0 0 480 360" onload="initTest(evt)" 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: interact-dom-01-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 32 <script type="text/ecmascript"> 33 <![CDATA[ 34 35 var svg_ns = "http://www.w3.org/2000/svg" 36 var doc; 37 var content; 38 var startButton; 39 var buttonRect; 40 var yLocation = 280; 41 // 42 // onload handler for top level svg element. Sets a UI event listener for 43 // the test start button. 44 // 45 function initTest(evt){ 46 // Get Document 47 var target = evt.target; 48 doc = target.ownerDocument; 49 content = doc.getElementById("test-body-content"); 50 51 // Get start rect and add a UI listener 52 startButton = doc.getElementById("startButton"); 53 buttonRect = doc.getElementById("buttonRect"); 54 startButton.addEventListener("click", uiEventDetected, false); 55 } 56 57 // 58 // click handler for 'startButton' rect element. 59 // 60 function uiEventDetected(evt) { 61 // 62 // Add an element to show that UI event was detected 63 // 64 var newText = doc.createElementNS(svg_ns, 'text'); 65 newText.setAttribute('x', '5'); 66 newText.setAttribute('y', yLocation); 67 newText.setAttribute('font-size', '40'); 68 var message = "Event Listeners supported"; 69 var textContent = doc.createTextNode(message); 70 newText.appendChild(textContent); 71 content.appendChild(newText); 72 73 startButton.removeEventListener("click", uiEventDetected, false); 74 75 // Make start button green 76 buttonRect.setAttribute("fill", "#88ff88"); 77 buttonRect.setAttribute("stroke", "black"); 78 79 // If test does not successfully remove the event listener, then 80 // a second click will cause a subsequent text string to appear 50 units 81 // below the first new text string. 82 yLocation = yLocation + 50; 83 } 84 85 ]]> 86 </script> 87 88 <!-- ===================================================================== --> 89 <!-- Start button --> 90 <!-- ===================================================================== --> 91 <g id="startButton"> 92 <rect id="buttonRect" x="65" y="20" width="350" height="200" fill="#dddddd" stroke="black"/> 93 <text font-size="54" x="120" y="130">Start Test</text> 94 </g> 95 </g> 96 <g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> 97 <text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.8 $</text> 98 </g> 99 <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> 100 <!-- comment out this watermark once the test is approved --> 101 <!--<g id="draft-watermark"> 102 <rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> 103 <text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" 104 text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> 105 </g>--> 106 </svg> 107 </body> 108 </html>