Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #9466: ie6leak.htm

File ie6leak.htm, 0.8 kB (added by micheldavid, 7 months ago)

aggressive bug example

Line 
1 <html>
2 <head>
3 <script type="text/javascript" src="prototype1.6.js"></script>
4 <script type="text/javascript">
5                 var els = [];
6
7                 function createElement(holder, n) {
8                         var span = document.createElement("span");
9                         span.appendChild(document.createTextNode(" " + n + " "));
10                         Event.observe(span, "mousemove", function(ev) {
11                                 span.style.backgroundColor = "red";
12                         });
13                         holder.appendChild(span);
14                         els.push(span);
15                         if (els.length > 10) {
16                                 holder.removeChild(els.shift());
17                         }
18                 }
19
20                 function start() {
21                         var placeholder = $("testArea");
22                         var i = 0;
23                         var doIt = function() {
24                                 createElement(placeholder, i++);
25                                 if (i <= 1000) setTimeout(doIt, 0.01);
26                         };
27                         doIt()
28                 }
29 </script>
30 </head>
31 <body>
32         <button onclick="start()">Start Test</button>
33         <div id="testArea"></div>
34 </body>
35 </html>