]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dijit/bench/widget_construction_test.php
Comment class stub
[eow] / static / dojo-release-1.1.1 / dijit / bench / widget_construction_test.php
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2         "http://www.w3.org/TR/html4/strict.dtd">
3
4 <html>
5         <head>
6                 <title>test of various synchronous page searching methods</title>
7                 <style type="text/css">
8                         @import "../../dojo/resources/dojo.css";
9                         @import "../themes/tundra/tundra.css";
10                 </style>
11                 <script type="text/javascript" src="../../dojo/dojo.js"
12                         djConfig="parseOnLoad: true, isDebug: true"></script>
13                 <script type="text/javascript">
14                         dojo.require("dojo.parser");    // scan page for widgets and instantiate them
15                         dojo.require("dijit._Widget");
16                         dojo.require("dijit._Templated");
17
18                         /* dummy widget for benchmarking purposes */
19                         dojo.declare(
20                                 "SimpleButton",
21                                 [ dijit._Widget, dijit._Templated ],
22                                 function(){  },
23                                 {
24                                         label: "",
25                         
26                                         templateString: "<button dojoAttachEvent='onclick:onClick'>${label}</button>",
27                         
28                                         onClick: function(){
29                                                 this.domNode.style.backgroundColor="green";
30                                         },
31                                         postCreate: function(){
32                                         }
33                                 }
34                         );
35                 </script>
36         </head>
37         <body>
38                 <h1 style="font-size: 40px; line-height: 50px;">This page contains a huge number of nodes, most of which are "chaff".</h1>
39                 <h3>Here's the relative timings for this page</h3>
40                 <div id="profileOutputTable"></div>
41                 <!--
42                 <h3>And some comparison data</h3>
43                 <table border=1>
44                 <thead>
45                         <tr>
46                                 <th>IE
47                                 <th>Safari
48                                 <th>Gecko (on PC)
49                                 <th>Gecko (on intel mac)
50                         </tr>
51                 </thead>
52                 <tbody>
53                         <tr>
54                                 <td>4890
55                                 <td>3242
56                                 <td>3094
57                                 <td>3782
58                         </tr>
59                 </tbody>
60                 </table>
61                 -->
62
63
64 <?
65         $containerDepth = 30;
66         $leadingChaff = 100;
67         $trailingChaff = 100;
68         $items = 100;
69 ?>
70 <? 
71         function generateChaff($iters){
72                 for($i=0;$i<$iters;$i++){ ?>
73                         <pre class="highlighted"><code><span class="hl-reserved">var </span><span class="hl-identifier">dlg</span><span class="hl-default"> = </span><span class="hl-reserved">new </span><span class="hl-identifier">blah</span><span class="hl-default">.</span><span class="hl-identifier">ext</span><span class="hl-default">.</span><span class="hl-identifier">LayoutDialog</span><span class="hl-brackets">(</span><span class="hl-identifier">config</span><span class="hl-code">.</span><span class="hl-identifier">id</span><span class="hl-code"> || </span><span class="hl-identifier">blah</span><span class="hl-code">.</span><span class="hl-identifier">util</span><span class="hl-code">.</span><span class="hl-identifier">Dom</span><span class="hl-code">.</span><span class="hl-identifier">generateId</span><span class="hl-brackets">()</span><span class="hl-code">, </span><span class="hl-brackets">{
74                                 </span><span title="autoCreate" class="hl-identifier">autoCreate</span><span class="hl-code"> : </span><span class="hl-reserved">true</span><span class="hl-code">,
75                                 </span><span title="minWidth" class="hl-identifier">minWidth</span><span class="hl-code">:</span><span class="hl-number">400</span><span class="hl-code">,
76                                 </span><span title="minHeight" class="hl-identifier">minHeight</span><span class="hl-code">:</span><span class="hl-number">300</span><span class="hl-code">,
77                                 </span>
78                                 <span title="syncHeightBeforeShow" class="hl-identifier">syncHeightBeforeShow</span><span class="hl-code">: </span><span class="hl-reserved">true</span><span class="hl-code">,
79                                 </span><span title="shadow" class="hl-identifier">shadow</span><span class="hl-code">:</span><span class="hl-reserved">true</span><span class="hl-code">,
80                                 </span><span title="fixedcenter" class="hl-identifier">fixedcenter</span><span class="hl-code">: </span><span class="hl-reserved">true</span><span class="hl-code">,
81                                 </span><span title="center" class="hl-identifier">center</span><span class="hl-code">:</span><span class="hl-brackets">{</span><span class="hl-identifier">autoScroll</span><span class="hl-code">:</span><span class="hl-reserved">false</span><span class="hl-brackets">}</span><span class="hl-code">,
82                                 </span><span title="east"  class="hl-identifier">east</span><span class="hl-code">:</span><span class="hl-brackets">{</span><span class="hl-identifier">split</span><span class="hl-code">:</span><span class="hl-reserved">true</span><span class="hl-code">,</span><span class="hl-identifier">initialSize</span><span class="hl-code">:</span><span class="hl-number">150</span><span class="hl-code">,</span><span class="hl-identifier">minSize</span><span class="hl-code">:</span><span class="hl-number">150</span><span class="hl-code">,</span><span class="hl-identifier">maxSize</span><span class="hl-code">:</span><span class="hl-number">250</span><span class="hl-brackets">}
83                         })</span><span class="hl-default">;
84                         </span><span class="hl-identifier">dlg</span><span class="hl-default">.</span><span class="hl-identifier">setTitle</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">Choose an Image</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-default">;
85                         </span><span class="hl-identifier">dlg</span><span class="hl-default">.</span><span class="hl-identifier">getEl</span><span class="hl-brackets">()</span><span class="hl-default">.</span><span class="hl-identifier">addClass</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">ychooser-dlg</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-default">;</span></code></pre><br />
86                         <pre class="highlighted"><code><span class="hl-reserved">var </span><span class="hl-identifier">animated</span><span class="hl-default"> = </span><span class="hl-reserved">new </span><span class="hl-identifier">blah</span><span class="hl-default">.</span><span class="hl-identifier">ext</span><span class="hl-default">.</span><span class="hl-identifier">Resizable</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">animated</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-brackets">{
87                             </span><span title="east" class="hl-identifier">width</span><span class="hl-code">: </span><span class="hl-number">200</span><span class="hl-code">,
88                             </span><span title="east" class="hl-identifier">height</span><span class="hl-code">: </span><span class="hl-number">100</span><span class="hl-code">,
89                             </span><span title="east" class="hl-identifier">minWidth</span><span class="hl-code">:</span><span class="hl-number">100</span><span class="hl-code">,
90                             </span><span class="hl-identifier">minHeight</span><span class="hl-code">:</span><span class="hl-number">50</span><span class="hl-code">,
91                             </span><span class="hl-identifier">animate</span><span class="hl-code">:</span><span class="hl-reserved">true</span><span class="hl-code">,
92                             </span><span class="hl-identifier">easing</span><span class="hl-code">: </span><span class="hl-identifier">YAHOO</span><span class="hl-code">.</span><span class="hl-identifier">util</span><span class="hl-code">.</span><span class="hl-identifier">Easing</span><span class="hl-code">.</span><span class="hl-identifier">backIn</span><span class="hl-code">,
93                             </span><span class="hl-identifier">duration</span><span class="hl-code">:</span><span class="hl-number">.6
94                         </span><span class="hl-brackets">})</span><span class="hl-default">;</span></code></pre>
95                         <h4>The standard Lorem Ipsum passage, used since the 1500s</h4>
96                         <p>
97                         "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
98                         eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
99                         ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
100                         aliquip ex ea commodo consequat. Duis aute irure dolor in
101                         reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
102                         pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
103                         culpa qui officia deserunt mollit anim id est laborum."
104                         </p>
105
106                         <h4>Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC</h4>
107
108                         <p>
109                         "Sed ut perspiciatis unde omnis iste natus error sit voluptatem
110                         accusantium doloremque laudantium, totam rem aperiam, eaque ipsa
111                         quae ab illo inventore veritatis et quasi architecto beatae vitae
112                         dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit
113                         aspernatur aut odit aut fugit, sed quia consequuntur magni dolores
114                         eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam
115                         est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci
116                         velit, sed quia non numquam eius modi tempora incidunt ut labore et
117                         dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam,
118                         quis nostrum exercitationem ullam corporis suscipit laboriosam,
119                         nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure
120                         reprehenderit qui in ea voluptate velit esse quam nihil molestiae
121                         consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla
122                         pariatur?"
123                         </p>
124
125                         <h4>1914 translation by H. Rackham</h4>
126
127                         <p>
128                         "But I must explain to you how all this mistaken idea of denouncing
129                         pleasure and praising pain was born and I will give you a complete
130                         account of the system, and expound the actual teachings of the
131                         great explorer of the truth, the master-builder of human happiness.
132                         No one rejects, dislikes, or avoids pleasure itself, because it is
133                         pleasure, but because those who do not know how to pursue pleasure
134                         rationally encounter consequences that are extremely painful. Nor
135                         again is there anyone who loves or pursues or desires to obtain
136                         pain of itself, because it is pain, but because occasionally
137                         circumstances occur in which toil and pain can procure him some
138                         great pleasure. To take a trivial example, which of us ever
139                         undertakes laborious physical exercise, except to obtain some
140                         advantage from it? But who has any right to find fault with a man
141                         who chooses to enjoy a pleasure that has no annoying consequences,
142                         or one who avoids a pain that produces no resultant pleasure?" 
143                         </p>
144                 <? } 
145         } // end generateChaff
146         $widgetName = "SimpleButton";
147 ?>
148 <? generateChaff($leadingChaff); ?>
149 <hr>
150 <? for($i=0;$i<$containerDepth;$i++){ ?>
151         <table border="1" cellpadding="0" cellspacing="0" width="100%">
152         <!--
153         <table>
154         -->
155                 <tr>
156                         <td>
157                         <br>
158                         chaff!
159                         <br>
160 <? } ?>
161 <? for($i=0;$i<$items;$i++){ ?>
162                         <div dojoType="<?= $widgetName ?>" label="item2 <?= $i ?>">item2 <?= $i ?></div>
163 <? } ?>
164 <? for($i=0;$i<$containerDepth;$i++){ ?>
165                         </td>
166                 </tr>
167         </table>
168 <? } ?>
169 <? generateChaff($trailingChaff);  ?>
170 <? for($i=0;$i<$items;$i++){ ?>
171         <div dojoType="<?= $widgetName ?>" label="item2 <?= $i ?>"><span>item <?= $i ?></span></div>
172 <? } ?>
173
174 <script type="text/javascript">
175
176                 oldTime = new Date();
177                 dojo.addOnLoad(function(){
178                         var time = new Date().getTime() - oldTime;
179                         var p = document.createElement("p");
180                         alert("Widgets loaded in " + time + "ms");
181                 });
182
183 </script>
184
185         </body>
186 </html>