a:9:{s:9:"#provides";s:22:"dojox.xml.widgetParser";s:9:"#resource";s:19:"xml/widgetParser.js";s:9:"#requires";a:2:{i:0;a:2:{i:0;s:6:"common";i:1;s:16:"dojox.xml.parser";}i:1;a:3:{i:0;s:6:"common";i:1;s:11:"dojo.parser";i:2;s:4:"dojo";}}s:22:"dojox.xml.widgetParser";a:6:{s:4:"type";s:8:"Function";s:11:"initialized";b:1;s:6:"source";s:4603:" var d = dojo;
this.parseNode = function(node){
var toBuild = [];
//TODO figure out the proper type
d.query("script[type='text/xml']", node).forEach(function(script){
toBuild.push.apply(toBuild, this._processScript(script));
}, this).orphan();
//instantiate everything at the end, doing it piecewise can give ID conflicts
return d.parser.instantiate(toBuild);
};
this._processScript = function(script){
//the text is either loaded from a separate file by the src
//attribute or underneath the src tag
var text = script.src ? d._getText(script.src) : script.innerHTML || script.firstChild.nodeValue;
var htmlNode = this.toHTML( dojox.xml.parser.parse(text).firstChild );
//make the list BEFORE we copy things over to keep the query scope as
//small as possible
var ret = d.query('[dojoType]', htmlNode);
//remove the script tag and replace with new HTML block
dojo.query(">", htmlNode).place(script, "before")
script.parentNode.removeChild(script);
return ret;
};
/**
* Given an XML node converts it to HTML where the existing HTML
* is preserved and the dojo widget tags are converted to divs
* with dojoType on them.
*/
this.toHTML = function (/*XmlNode*/ node){
var newNode;
var nodeName = node.nodeName;
var dd = dojo.doc;
var type = node.nodeType;
///node type 3 and 4 are text and cdata
if(type >= 3){
return dd.createTextNode( (type == 3 || type == 4) ? node.nodeValue : "" );
}
var localName = node.localName||nodeName.split(":").pop();
//TODO:
// only check for namespace ONCE ever, instead of each time here,
// by mixing in the right check for each browser?
var namespace = node.namespaceURI || (node.getNamespaceUri ? node.getNamespaceUri() : "");
//TODO check for some real namespace
if(namespace == "html"){
newNode = dd.createElement(localName);
}else{
var dojoType = namespace + "." + localName;
/**
* This is a horrible hack we need because creating a