Skip to content
Browse files

add force redraw snippet

  • Loading branch information...
1 parent bc651bd commit ef94cadb27699fe947a900e71e6bf229273b1a49 @madrobby committed
Showing with 26 additions and 0 deletions.
  1. +9 −0 redraw/redraw.js
  2. +17 −0 redraw/test.html
View
9 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;
+ }
+});
View
17 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.
Something went wrong with that request. Please try again.