define( "dojo/parser", ["require", "./_base/kernel", "./_base/lang", "./_base/array", "./_base/config", "./_base/html", "./_base/window", "./_base/url", "./_base/json", "./aspect", "./date/stamp", "./Deferred", "./has", "./query", "./on", "./ready"], function(require, dojo, dlang, darray, config, dhtml, dwindow, _Url, djson, aspect, dates, Deferred, has, query, don, ready){ // module: // dojo/parser new Date("X"); // workaround for #11279, new Date("") == NaN // Widgets like BorderContainer add properties to _Widget via dojo.extend(). // If BorderContainer is loaded after _Widget's parameter list has been cached, // we need to refresh that parameter list (for _Widget and all widgets that extend _Widget). var extendCnt = 0; aspect.after(dlang, "extend", function(){ extendCnt++; }, true); function getNameMap(ctor){ // summary: // Returns map from lowercase name to attribute name in class, ex: {onclick: "onClick"} var map = ctor._nameCaseMap, proto = ctor.prototype; // Create the map if it's undefined. // Refresh the map if a superclass was possibly extended with new methods since the map was created. if(!map || map._extendCnt < extendCnt){ map = ctor._nameCaseMap = {}; for(var name in proto){ if(name.charAt(0) === "_"){ continue; } // skip internal properties map[name.toLowerCase()] = name; } map._extendCnt = extendCnt; } return map; } // Map from widget name or list of widget names(ex: "dijit/form/Button,acme/MyMixin") to a constructor. var _ctorMap = {}; function getCtor(/*String[]*/ types){ // summary: // Retrieves a constructor. If the types array contains more than one class/MID then the // subsequent classes will be mixed into the first class and a unique constructor will be // returned for that array. var ts = types.join(); if(!_ctorMap[ts]){ var mixins = []; for(var i = 0, l = types.length; i < l; i++){ var t = types[i]; // TODO: Consider swapping getObject and require in the future mixins[mixins.length] = (_ctorMap[t] = _ctorMap[t] || (dlang.getObject(t) || (~t.indexOf('/') && require(t)))); } var ctor = mixins.shift(); _ctorMap[ts] = mixins.length ? (ctor.createSubclass ? ctor.createSubclass(mixins) : ctor.extend.apply(ctor, mixins)) : ctor; } return _ctorMap[ts]; } var parser = { // summary: // The Dom/Widget parsing package _clearCache: function(){ // summary: // Clear cached data. Used mainly for benchmarking. extendCnt++; _ctorMap = {}; }, _functionFromScript: function(script, attrData){ // summary: // Convert a `` // into a function // script: DOMNode // The `` node, // calls require() to load the specified modules and (asynchronously) assign them to the specified global // variables, and returns a Promise for when that operation completes. // // In the example above, it is effectively doing a require(["acme/bar", ...], function(a){ bar = a; }). var hash = djson.fromJson("{" + script.innerHTML + "}"), vars = [], mids = [], d = new Deferred(); for(var name in hash){ vars.push(name); mids.push(hash[name]); } require(mids, function(){ for(var i=0; ibar: "acme/bar", ...` node, calls require() to load the // specified modules and (asynchronously) assign them to the specified global variables, // and returns a Promise for when those operations complete. // root: DomNode // The node to base the scan from. // Promise that resolves when all the