Author: ivaynberg
Date: Fri Apr 27 22:32:11 2007
New Revision: 533296

URL: http://svn.apache.org/viewvc?view=rev&rev=533296
Log:
added Wicket.$ - matej feel free to change this to whatever as long as it 
returns null if element is not found. added nullcheck to wicketshow and 
wickethide, now indicating links dont cause javascript errors if whatever 
element they are attached to is removed by ajax.

Modified:
    
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js

Modified: 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js?view=diff&rev=533296&r1=533295&r2=533296
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
 (original)
+++ 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
 Fri Apr 27 22:32:11 2007
@@ -36,6 +36,21 @@
 if (typeof(Wicket) == "undefined")
        Wicket = { };
 
+
+Wicket.$=function(arg) {
+       if (arguments.length > 1) {
+               var e=[];
+               for (var i=0; i<arguments.length; i++) {
+                       e.push(Wicket.$(arguments[i]));
+               }
+               return e;
+       } else if (typeof arg == 'string') {
+               return document.getElementById(arg);
+       } else {
+               return arg;
+       }
+}
+
 Wicket.emptyFunction = function() { };
 
 Wicket.Class = {
@@ -1621,16 +1636,20 @@
 }
 
 function wicketGet(id) {
-    return document.getElementById(id);
+    return Wicket.$(id);
 }
 
 function wicketShow(id) {
     var e=wicketGet(id);
-    e.style.display = "";
+    if (e!=null) {
+           e.style.display = "";
+       }
 }
 
 function wicketHide(id) {
     var e=wicketGet(id);
-    e.style.display = "none";
+       if (e!=null) {
+           e.style.display = "none";
+       }
 }
 


Reply via email to