Bug Tracker

Ticket #4407: Untitled-1.html

File Untitled-1.html, 1.9 KB (added by jerone, 13 years ago)

testcase

Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5<title>Untitled Document</title>
6<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
7<script>
8function test1(){
9        console.time("test1")
10        $('#selectje1').empty();
11        console.timeEnd("test1")
12}
13function test2(){
14        console.time("test2")
15        document.getElementById('selectje2').options.length = 0;
16        console.timeEnd("test2")
17}
18function test3(){
19        console.time("test3")
20        var test3 = document.getElementById('selectje3');
21        while ( test3.firstChild ) {
22                        test3.removeChild( test3.firstChild );
23        }
24        console.timeEnd("test3")
25}
26</script>
27</head>
28
29<body>
30<select id="selectje1">
31<option>sdfsd</option>
32<option>sdfsd</option>
33<option>sdfsd</option>
34<option>sdfsd</option>
35<option>sdfsd</option>
36<option>sdfsd</option>
37<option>sdfsd</option>
38<option>sdfsd</option>
39<option>sdfsd</option>
40<option>sdfsd</option>
41</select>
42<input type="button" value="empty()" onClick="test1()" />
43
44<hr />
45
46<select id="selectje2">
47<option>sdfsd</option>
48<option>sdfsd</option>
49<option>sdfsd</option>
50<option>sdfsd</option>
51<option>sdfsd</option>
52<option>sdfsd</option>
53<option>sdfsd</option>
54<option>sdfsd</option>
55<option>sdfsd</option>
56<option>sdfsd</option>
57</select>
58<input type="button" value="options.length=0" onClick="test2()" />
59
60<hr />
61
62<select id="selectje3">
63<option>sdfsd</option>
64<option>sdfsd</option>
65<option>sdfsd</option>
66<option>sdfsd</option>
67<option>sdfsd</option>
68<option>sdfsd</option>
69<option>sdfsd</option>
70<option>sdfsd</option>
71<option>sdfsd</option>
72<option>sdfsd</option>
73</select>
74<input type="button" value="while removechild" onClick="test3()" />
75</body>
76
77</html>