Permalink
Browse files

Convert robot*.js files to baseless AMD, and remove document.write() …

…usage.

 
 To get util/doh/robot.js to play nice with AMD (no document.write(), and no reference to dojo global), I introduced a dependency to dojo which theoretically wasn't needed before.   Perhaps it can be removed in the future.   If isolation is desired, the dojo-dependent code should be moved to dojo/robot.js, not put if if(){...} blocks.
 
 Also removed the document.write() usage in dojo/robotx.js to create a console div.   On IE6/IE7, we are already getting a firebug-lite console, so just using that.   (This might be dependent on having isDebug:true in the data-dojo-config of the test file though.)
 
 Theoretically fixes #14929 !strict.
  • Loading branch information...
1 parent 76c4593 commit 7debc1c07945c0b3c0d24238ddc8dc715f215909 @wkeese wkeese committed Apr 16, 2012
Showing with 16 additions and 22 deletions.
  1. +16 −22 robotx.js
View
@@ -1,34 +1,28 @@
define([
- "dojo/_base/kernel", // dojo.experimental lang.mixin
- "./main",
- "dojo/_base/lang", // dojo.experimental lang.mixin
- "./robot",
- "dojo/robotx",
- "dojo/_base/window" // dojo.global
-], function(dojo, dijit_, lang){
+ "dojo/_base/kernel", // kernel.experimental
+ "./main", // original dijit variable in main window
+ "dojo/robotx" // includes doh/robot, dojo/robot, and dojo/robotx, all of which affect and return doh/robot module
+], function(kernel, dijit_, robot){
// module:
// dijit/robotx
// summary:
- // Code needed by robot test harness
+ // Loads doh/robot, dojo/robot, dojo/robotx, and
+ // sets dijit global in main window to point to the dijit loaded in the iframe.
+ // TODO: Remove for 2.0. Tests shouldn't reference a dijit global at all, and should load dojo/robotx
+ // in preference to this file.
+ kernel.experimental("dijit.robotx");
- //WARNING: This module depends on GLOBAL dijit being set for v1.5 code; therefore the lexical variable that
- //references "dijit" has been renamed to "dijit_"
+ var __updateDocument = robot._updateDocument;
- dojo.experimental("dijit.robotx");
-
- var __updateDocument = doh.robot._updateDocument;
-
- lang.mixin(doh.robot,{
- _updateDocument: function(){
- __updateDocument();
- var win = dojo.global;
- if(win["dijit"]){
- window.dijit = win.dijit; // window reference needed for IE
- }
+ robot._updateDocument = function(){
+ __updateDocument();
+ var win = kernel.global;
+ if(win.dijit){
+ window.dijit = win.dijit; // window reference needed for IE
}
- });
+ };
return dijit_;
});

0 comments on commit 7debc1c

Please sign in to comment.