Skip to content

Commit

Permalink
add force redraw snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
madrobby committed Jan 11, 2009
1 parent bc651bd commit ef94cad
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions redraw/redraw.js
@@ -0,0 +1,9 @@
Element.addMethods({
redraw: function(element){
element = $(element);
var n = document.createTextNode(' ');
element.appendChild(n);
(function(){n.parentNode.removeChild(n)}).defer();
return element;
}
});
17 changes: 17 additions & 0 deletions redraw/test.html
@@ -0,0 +1,17 @@
<!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>Redraw demonstration</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="../lib/prototype/dist/prototype.js" type="text/javascript"></script>
<script src="redraw.js" type="text/javascript"></script>
</head>
<body>
<p id="test">test</p>

<script type="text/javascript" charset="utf-8">
$('test').redraw();
</script>
</body>
</html>

0 comments on commit ef94cad

Please sign in to comment.