/** * @file bootstrap1.js * * summary: First file that is loaded that 'bootstraps' the entire dojo library suite. * note: Must run before hostenv_*.js file. * * @author Copyright 2004 Mark D. Anderson (mda@discerning.com) * TODOC: should the copyright be changed to Dojo Foundation? * @license Licensed under the Academic Free License 2.1 http://www.opensource.org/licenses/afl-2.1.php * * $Id: bootstrap1.js 4342 2006-06-11 23:03:30Z alex $ */ // TODOC: HOW TO DOC THE BELOW? // @global: djConfig // summary: // Application code can set the global 'djConfig' prior to loading // the library to override certain global settings for how dojo works. // description: The variables that can be set are as follows: // - isDebug: false // - allowQueryConfig: false // - baseScriptUri: "" // - baseRelativePath: "" // - libraryScriptUri: "" // - iePreventClobber: false // - ieClobberMinimal: true // - preventBackButtonFix: true // - searchIds: [] // - parseWidgets: true // TODOC: HOW TO DOC THESE VARIABLES? // TODOC: IS THIS A COMPLETE LIST? // note: // 'djConfig' does not exist under 'dojo.*' so that it can be set before the // 'dojo' variable exists. // note: // Setting any of these variables *after* the library has loaded does nothing at all. // TODOC: is this still true? Release notes for 0.3 indicated they could be set after load. // //TODOC: HOW TO DOC THIS? // @global: dj_global // summary: // an alias for the top-level global object in the host environment // (e.g., the window object in a browser). // description: // Refer to 'dj_global' rather than referring to window to ensure your // code runs correctly in contexts other than web browsers (eg: Rhino on a server). var dj_global = this; function dj_undef(/*String*/ name, /*Object?*/ object){ //summary: Returns true if 'name' is defined on 'object' (or globally if 'object' is null). //description: Note that 'defined' and 'exists' are not the same concept. if(object==null){ object = dj_global; } // exception if object is not an Object return (typeof object[name] == "undefined"); // Boolean } // make sure djConfig is defined if(dj_undef("djConfig")){ var djConfig = {}; } //TODOC: HOW TO DOC THIS? // dojo is the root variable of (almost all) our public symbols -- make sure it is defined. if(dj_undef("dojo")){ var dojo = {}; } //TODOC: HOW TO DOC THIS? dojo.version = { // summary: version number of this instance of dojo. major: 0, minor: 3, patch: 1, flag: "", revision: Number("$Rev: 4342 $".match(/[0-9]+/)[0]), toString: function(){ with(dojo.version){ return major + "." + minor + "." + patch + flag + " (" + revision + ")"; // String } } } dojo.evalProp = function(/*String*/ name, /*Object*/ object, /*Boolean?*/ create){ // summary: Returns 'object[name]'. If not defined and 'create' is true, will return a new Object. // description: // Returns null if 'object[name]' is not defined and 'create' is not true. // Note: 'defined' and 'exists' are not the same concept. return (object && !dj_undef(name, object) ? object[name] : (create ? (object[name]={}) : undefined)); // mixed } dojo.parseObjPath = function(/*String*/ path, /*Object?*/ context, /*Boolean?*/ create){ // summary: Parse string path to an object, and return corresponding object reference and property name. // description: // Returns an object with two properties, 'obj' and 'prop'. // 'obj[prop]' is the reference indicated by 'path'. // path: Path to an object, in the form "A.B.C". // context: Object to use as root of path. Defaults to 'dj_global'. // create: If true, Objects will be created at any point along the 'path' that is undefined. var object = (context != null ? context : dj_global); var names = path.split('.'); var prop = names.pop(); for (var i=0,l=names.length;i