Debian Codegraph @

dojox/gfx/tests/svgweb/test_destroy.html

raw symbols SCIP
1 <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
2 <head>
3 <title>Testing surface.destroy()</title>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <style type="text/css">
6 @import "../../../../dojo/resources/dojo.css";
7 @import "../../../../dijit/tests/css/dijitTests.css";
8 </style>
9 <!-- SVGWEB { -->
10 <meta name="svg.render.forceflash" content="true"/>
11 <script src="svgweb/src/svg.js" data-path="svgweb/src"></script>
12 <script src="../../../../dojo/dojo.js" data-dojo-config="isDebug:true,forceGfxRenderer:'svg'" type="text/javascript"></script>
13 <!-- } -->
14 <script type="text/javascript">
15 dojo.require("dojox.gfx");
16
17 surface = null;
18
19 makeShapes = function(){
20 if(surface){
21 surface.destroy();
22 surface = null;
23 var t = dojo.byId("test").innerHTML;
24 if(t){
25 console.error("Garbage detected: " + t);
26 }else{
27 console.log("The parent node was cleaned up properly.");
28 }
29 }
30 surface = dojox.gfx.createSurface("test", 500, 500);
31 /* SVGWEB { */
32 surface.whenLoaded(function() {
33 var path = surface.createPath("");
34 // form concentric circles
35 var center = {x: 250, y: 250};
36 for(var r = 200; r > 0; r -= 30){
37 // make two 180 degree arcs to form a circle
38 var start = {x: center.x, y: center.y - r};
39 var end = {x: center.x, y: center.y + r};
40 path.moveTo(start).arcTo(r, r, 0, true, true, end).arcTo(r, r, 0, true, true, start).closePath();
41 }
42 // set visual attributes
43 path.setFill("red").setStroke("black");
44 });
45 /* } */
46 };
47
48 dojo.addOnLoad(makeShapes);
49 </script>
50 </head>
51 <body>
52 <h1>Testing surface.destroy()</h1>
53 <p><button onclick="makeShapes();">Regenerate</button></p>
54 <p><em>See the firebug log for detailed reports.</em></p>
55 <div id="test" style="width: 500px; height: 500px;"></div>
56 <p>That's all Folks!</p>
57 </body>
58 </html>