Side navigation
Ticket #3078: issue3078.html
File issue3078.html, 2.1 KB (added by jeberma, June 24, 2008 05:03AM UTC)
a short script that demonstrates the caching issue
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>jQuery validation plug-in - comment form example</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
<script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../jquery.validate.js" type="text/javascript"></script>
<!-- for styling the form -->
<script src="js/cmxforms.js" type="text/javascript"></script>
<script type="text/javascript">
function run() {
for(var i=0; i<1000; i++) {
var h = document.body.innerHTML;
// this does not free the cache
$('#commentForm').remove();
// this works
//$('#commentForm').remove().removeData();
document.body.innerHTML = h;
$("#commentForm").validate();
}
alert('finished');
// please run in firebug
if(typeof console !== 'undefined') {
console.dir($.cache);
}
}
</script>
<style type="text/css">
#commentForm { width: 500px; }
#commentForm label { width: 250px; }
#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
</style>
</head>
<body>
<input type="button" value="run" onclick="run()"/>
<form class="cmxform" id="commentForm" method="post" action="">
<fieldset>
<legend>Please provide your name, email address (won't be published) and a comment</legend>
<p>
<label for="cname">Name (required, at least 2 characters)</label>
<input id="cname" name="name" class="required" minlength="2" />
<p>
<label for="cemail">E-Mail (required)</label>
<input id="cemail" name="email" class="required email" />
</p>
<p>
<label for="curl">URL (optional)</label>
<input id="curl" name="url" class="url" value="" />
</p>
<p>
<label for="ccomment">Your comment (required)</label>
<textarea id="ccomment" name="comment" class="required"></textarea>
</p>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
</fieldset>
</form>
</body>
</html>
Download in other formats:
Original Format
File issue3078.html, 2.1 KB (added by jeberma, June 24, 2008 05:03AM UTC)
a short script that demonstrates the caching issue
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>jQuery validation plug-in - comment form example</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
<script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../jquery.validate.js" type="text/javascript"></script>
<!-- for styling the form -->
<script src="js/cmxforms.js" type="text/javascript"></script>
<script type="text/javascript">
function run() {
for(var i=0; i<1000; i++) {
var h = document.body.innerHTML;
// this does not free the cache
$('#commentForm').remove();
// this works
//$('#commentForm').remove().removeData();
document.body.innerHTML = h;
$("#commentForm").validate();
}
alert('finished');
// please run in firebug
if(typeof console !== 'undefined') {
console.dir($.cache);
}
}
</script>
<style type="text/css">
#commentForm { width: 500px; }
#commentForm label { width: 250px; }
#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
</style>
</head>
<body>
<input type="button" value="run" onclick="run()"/>
<form class="cmxform" id="commentForm" method="post" action="">
<fieldset>
<legend>Please provide your name, email address (won't be published) and a comment</legend>
<p>
<label for="cname">Name (required, at least 2 characters)</label>
<input id="cname" name="name" class="required" minlength="2" />
<p>
<label for="cemail">E-Mail (required)</label>
<input id="cemail" name="email" class="required email" />
</p>
<p>
<label for="curl">URL (optional)</label>
<input id="curl" name="url" class="url" value="" />
</p>
<p>
<label for="ccomment">Your comment (required)</label>
<textarea id="ccomment" name="comment" class="required"></textarea>
</p>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
</fieldset>
</form>
</body>
</html>