//>>builtdefine("./_base/kernel ./_base/lang ./_base/array ./_base/declare ./dom ./dom-construct ./parser".split(" "),function(k,g,h,l,m,f,n){varp=0,e={_secureForInnerHtml:function(a){returna.replace(/(?:\s*<!DOCTYPE\s[^>]+>|<title[^>]*>[\s\S]*?<\/title>)/ig,"")},_emptyNode:f.empty,_setNodeContent:function(a,b){f.empty(a);if(b)if("number"==typeofb&&(b=b.toString()),"string"==typeofb&&(b=f.toDom(b,a.ownerDocument)),!b.nodeType&&g.isArrayLike(b))for(varc=b.length,d=0;d<b.length;d=c==b.length?d+1:0)f.place(b[d],a,"last");elsef.place(b,a,"last");returna},_ContentSetter:l("dojo.html._ContentSetter",null,{node:"",content:"",id:"",cleanContent:!1,extractContent:!1,parseContent:!1,parserScope:k._scopeName,startup:!0,constructor:function(a,b){g.mixin(this,a||{});b=this.node=m.byId(this.node||b);this.id||(this.id=["Setter",b?b.id||b.tagName:"",p++].join("_"))},set:function(a,b){void0!==a&&(this.content=a);"number"==typeofa&&(a=a.toString());b&&this._mixin(b);this.onBegin();this.setContent();return(a=this.onEnd())&&a.then?a:this.node},setContent:function(){vara=this.node;if(!a)throwError(this.declaredClass+": setContent given no node");try{a=e._setNodeContent(a,this.content)}catch(c){varb=this.onContentError(c);try{a.innerHTML=b}catch(d){console.error("Fatal "+this.declaredClass+".setContent could not change content due to "+d.message,d)}}this.node=a},empty:function(){this.parseDeferred&&(this.parseDeferred.isResolved()||this.parseDeferred.cancel(),deletethis.parseDeferred);this.parseResults&&this.parseResults.length&&(h.forEach(this.parseResults,function(a){a.destroy&&a.destroy()}),deletethis.parseResults);f.empty(this.node)},onBegin:function(){vara=this.content;if(g.isString(a)&&(this.cleanContent&&(a=e._secureForInnerHtml(a)),this.extractContent)){varb=a.match(/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im);b&&(a=b[1])}this.empty();this.content=a;returnthis.node},onEnd:function(){this.parseContent&&this._parse();returnthis.node},tearDown:function(){deletethis.parseResults;deletethis.parseDeferred;deletethis.node;deletethis.content},onContentError:function(a){return"Error occurred setting content: "+a},onExecError:function(a){return"Error occurred executing scripts: "+a},_mixin:function(a){varb={},c;for(cina)cinb||(this[c]=a[c])},_parse:function(){vara=this.node;try{varb={};h.forEach(["dir","lang","textDir"],function(a){this[a]&&(b[a]=this[a])},this);varc=this;this.parseDeferred=n.parse({rootNode:a,noStart:!this.startup,inherited:b,scope:this.parserScope}).then(function(a){returnc.parseResults=a},function(a){c._onError("Content",a,"Error parsing in _ContentSetter#"+this.id)})}catch(d){this._onError("Content",d,"Error parsing in _ContentSetter#"+this.id)}},_onError:function(a,b,c){a=this["on"+a+"Error"].call(this,b);c?console.error(c,b):a&&e._setNodeContent(this.node,a,!0)}}),set:function(a,b,c){void0==b&&(console.warn("dojo.html.set: no cont argument provided, using empty string"),b="");"number"==typeofb&&(b=b.toString());returnc?(newe._ContentSetter(g.mixin(c,{content:b,node:a}))).set():e._setNodeContent(a,b,!0)}};g.setObject("dojo.html",e);returne});