You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2006/12/02 23:01:15 UTC

svn commit: r481661 - /incubator/xap/trunk/src/dojo/src/event.js

Author: mturyn
Date: Sat Dec  2 15:01:12 2006
New Revision: 481661

URL: http://svn.apache.org/viewvc?view=rev&rev=481661
Log:
From Rob Gagne

Added some window.dojo checks on methods before using dojo.  This is to prevent "dojo is not defined" errors that were appearing in Firefox and IE.

See:
http://dojotoolkit.org/pipermail/dojo-contributors/2006-October/004805.html

Not sure if this is an actual fix, but at lease have not seen the errors since the changes.

Modified:
    incubator/xap/trunk/src/dojo/src/event.js

Modified: incubator/xap/trunk/src/dojo/src/event.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/event.js?view=diff&rev=481661&r1=481660&r2=481661
==============================================================================
--- incubator/xap/trunk/src/dojo/src/event.js (original)
+++ incubator/xap/trunk/src/dojo/src/event.js Sat Dec  2 15:01:12 2006
@@ -334,7 +334,7 @@
 				(obj["nodeType"])||
 				(obj["addEventListener"]) ){
 				isNode = true;
-				dojo.event.browser.addClobberNodeAttrs(obj, [jpname, jpfuncname, methname]);
+				window.dojo.event.browser.addClobberNodeAttrs(obj, [jpname, jpfuncname, methname]);
 			}
 		}
 		var origArity = obj[methname].length;
@@ -359,12 +359,13 @@
 				}
 
 				if(evt){
-					args.push(dojo.event.browser.fixEvent(evt, this));
+					args.push(window.dojo.event.browser.fixEvent(evt, this));
 				}
-			}else{
+			}else{
+				// add a check for dojo being defined to prevent dojo not defined errors; this is probably a problem somewhere else
 				for(var x=0; x<arguments.length; x++){
-					if((x==0)&&(isNode)&&(dojo.event.browser.isEvent(arguments[x]))){
-						args.push(dojo.event.browser.fixEvent(arguments[x], this));
+					if((x==0)&&(isNode)&&(window.dojo)&&(window.dojo.event)&&(window.dojo.event.browser.isEvent(arguments[x]))){
+						args.push(window.dojo.event.browser.fixEvent(arguments[x], this));
 					}else{
 						args.push(arguments[x]);
 					}
@@ -481,7 +482,7 @@
 		}
 
 		if(this.before.length>0){
-			dojo.lang.forEach(this.before, unrollAdvice);
+			if (window.dojo) window.dojo.lang.forEach(this.before, unrollAdvice);
 		}
 
 		var result;
@@ -493,7 +494,7 @@
 		}
 
 		if(this.after.length>0){
-			dojo.lang.forEach(this.after, unrollAdvice);
+			if (window.dojo) window.dojo.lang.forEach(this.after, unrollAdvice);
 		}
 
 		return (this.methodfunc) ? result : null;