Side navigation
Ticket #1403: sandbox.html
File sandbox.html, 1.8 KB (added by carlos.aguayo@gmail., July 16, 2007 08:09PM UTC)
Test case
<!DOCTYPE html public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html" />
<!--<script src="jquery-1.0.2.js" type="text/javascript"></script>-->
<script src="jquery-1.1.3.1.js" type="text/javascript"></script>
</head>
<style type="text/css">
body{
margin: 10px 0 0 20px;
}
#mytextfield{
display:none;
}
</style>
<body>
<input id="mytextfield" type="text">
<button id="create">create</button>
<button id="delete">delete</button>
<br/>
<div id="divcreate">Time to create: <span id="createTime"></span></div>
<div id="divdelete">Time to delete: <span id="deleteTime"></span></div>
<div id="container"></div>
<script>
var totalcreated = 0;
var n = 500;
var mytextfield = $("#mytextfield");
var container = $("#container");
var divcreate = $("#divcreate").hide();
var divdelete = $("#divdelete").hide();
$("#create").click(function(){
var starttime = new Date();
for (var i = 0; i < n; i++) {
var newtextfield = mytextfield.clone(true);
mytextfield.attr("id","mytextfield"+i);
mytextfield.click(someEvent);
container.append(newtextfield);
}
totalcreated += n;
var endtime = new Date();
$("#createTime").html((endtime - starttime)+"ms");
divcreate.show();
});
$("#delete").click(function(){
var starttime = new Date();
for (var i = 0; i < totalcreated; i++){
var textfield = $("#mytexttfield"+i);
textfield.unbind();
}
container.html("");
totalcreated = 0;
var endtime = new Date();
$("#deleteTime").html((endtime - starttime)+"ms");
divdelete.show();
});
function someEvent() {
alert('click');
}
</script>
</body>
</html>
Download in other formats:
Original Format
File sandbox.html, 1.8 KB (added by carlos.aguayo@gmail., July 16, 2007 08:09PM UTC)
Test case
<!DOCTYPE html public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html" />
<!--<script src="jquery-1.0.2.js" type="text/javascript"></script>-->
<script src="jquery-1.1.3.1.js" type="text/javascript"></script>
</head>
<style type="text/css">
body{
margin: 10px 0 0 20px;
}
#mytextfield{
display:none;
}
</style>
<body>
<input id="mytextfield" type="text">
<button id="create">create</button>
<button id="delete">delete</button>
<br/>
<div id="divcreate">Time to create: <span id="createTime"></span></div>
<div id="divdelete">Time to delete: <span id="deleteTime"></span></div>
<div id="container"></div>
<script>
var totalcreated = 0;
var n = 500;
var mytextfield = $("#mytextfield");
var container = $("#container");
var divcreate = $("#divcreate").hide();
var divdelete = $("#divdelete").hide();
$("#create").click(function(){
var starttime = new Date();
for (var i = 0; i < n; i++) {
var newtextfield = mytextfield.clone(true);
mytextfield.attr("id","mytextfield"+i);
mytextfield.click(someEvent);
container.append(newtextfield);
}
totalcreated += n;
var endtime = new Date();
$("#createTime").html((endtime - starttime)+"ms");
divcreate.show();
});
$("#delete").click(function(){
var starttime = new Date();
for (var i = 0; i < totalcreated; i++){
var textfield = $("#mytexttfield"+i);
textfield.unbind();
}
container.html("");
totalcreated = 0;
var endtime = new Date();
$("#deleteTime").html((endtime - starttime)+"ms");
divdelete.show();
});
function someEvent() {
alert('click');
}
</script>
</body>
</html>