summaryrefslogtreecommitdiff
path: root/lib/dojo/html.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dojo/html.js')
-rw-r--r--lib/dojo/html.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/dojo/html.js b/lib/dojo/html.js
index 97872db25..10fc9b04e 100644
--- a/lib/dojo/html.js
+++ b/lib/dojo/html.js
@@ -1,8 +1,8 @@
/*
- Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
//>>built
-define("dojo/html",["./_base/kernel","./_base/lang","./_base/array","./_base/declare","./dom","./dom-construct","./parser"],function(_1,_2,_3,_4,_5,_6,_7){_2.getObject("html",true,_1);var _8=0;_1.html._secureForInnerHtml=function(_9){return _9.replace(/(?:\s*<!DOCTYPE\s[^>]+>|<title[^>]*>[\s\S]*?<\/title>)/ig,"");};_1.html._emptyNode=_6.empty;_1.html._setNodeContent=function(_a,_b){_6.empty(_a);if(_b){if(typeof _b=="string"){_b=_6.toDom(_b,_a.ownerDocument);}if(!_b.nodeType&&_2.isArrayLike(_b)){for(var _c=_b.length,i=0;i<_b.length;i=_c==_b.length?i+1:0){_6.place(_b[i],_a,"last");}}else{_6.place(_b,_a,"last");}}return _a;};_4("dojo.html._ContentSetter",null,{node:"",content:"",id:"",cleanContent:false,extractContent:false,parseContent:false,parserScope:_1._scopeName,startup:true,constructor:function(_d,_e){_2.mixin(this,_d||{});_e=this.node=_5.byId(this.node||_e);if(!this.id){this.id=["Setter",(_e)?_e.id||_e.tagName:"",_8++].join("_");}},set:function(_f,_10){if(undefined!==_f){this.content=_f;}if(_10){this._mixin(_10);}this.onBegin();this.setContent();this.onEnd();return this.node;},setContent:function(){var _11=this.node;if(!_11){throw new Error(this.declaredClass+": setContent given no node");}try{_11=_1.html._setNodeContent(_11,this.content);}catch(e){var _12=this.onContentError(e);try{_11.innerHTML=_12;}catch(e){console.error("Fatal "+this.declaredClass+".setContent could not change content due to "+e.message,e);}}this.node=_11;},empty:function(){if(this.parseResults&&this.parseResults.length){_3.forEach(this.parseResults,function(w){if(w.destroy){w.destroy();}});delete this.parseResults;}_1.html._emptyNode(this.node);},onBegin:function(){var _13=this.content;if(_2.isString(_13)){if(this.cleanContent){_13=_1.html._secureForInnerHtml(_13);}if(this.extractContent){var _14=_13.match(/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im);if(_14){_13=_14[1];}}}this.empty();this.content=_13;return this.node;},onEnd:function(){if(this.parseContent){this._parse();}return this.node;},tearDown:function(){delete this.parseResults;delete this.node;delete this.content;},onContentError:function(err){return "Error occured setting content: "+err;},_mixin:function(_15){var _16={},key;for(key in _15){if(key in _16){continue;}this[key]=_15[key];}},_parse:function(){var _17=this.node;try{var _18={};_3.forEach(["dir","lang","textDir"],function(_19){if(this[_19]){_18[_19]=this[_19];}},this);this.parseResults=_7.parse({rootNode:_17,noStart:!this.startup,inherited:_18,scope:this.parserScope});}catch(e){this._onError("Content",e,"Error parsing in _ContentSetter#"+this.id);}},_onError:function(_1a,err,_1b){var _1c=this["on"+_1a+"Error"].call(this,err);if(_1b){console.error(_1b,err);}else{if(_1c){_1.html._setNodeContent(this.node,_1c,true);}}}});_1.html.set=function(_1d,_1e,_1f){if(undefined==_1e){console.warn("dojo.html.set: no cont argument provided, using empty string");_1e="";}if(!_1f){return _1.html._setNodeContent(_1d,_1e,true);}else{var op=new _1.html._ContentSetter(_2.mixin(_1f,{content:_1e,node:_1d}));return op.set();}};return _1.html;}); \ No newline at end of file
+define("dojo/html",["./_base/kernel","./_base/lang","./_base/array","./_base/declare","./dom","./dom-construct","./parser"],function(_1,_2,_3,_4,_5,_6,_7){var _8={};_2.setObject("dojo.html",_8);var _9=0;_8._secureForInnerHtml=function(_a){return _a.replace(/(?:\s*<!DOCTYPE\s[^>]+>|<title[^>]*>[\s\S]*?<\/title>)/ig,"");};_8._emptyNode=_6.empty;_8._setNodeContent=function(_b,_c){_6.empty(_b);if(_c){if(typeof _c=="string"){_c=_6.toDom(_c,_b.ownerDocument);}if(!_c.nodeType&&_2.isArrayLike(_c)){for(var _d=_c.length,i=0;i<_c.length;i=_d==_c.length?i+1:0){_6.place(_c[i],_b,"last");}}else{_6.place(_c,_b,"last");}}return _b;};_8._ContentSetter=_4("dojo.html._ContentSetter",null,{node:"",content:"",id:"",cleanContent:false,extractContent:false,parseContent:false,parserScope:_1._scopeName,startup:true,constructor:function(_e,_f){_2.mixin(this,_e||{});_f=this.node=_5.byId(this.node||_f);if(!this.id){this.id=["Setter",(_f)?_f.id||_f.tagName:"",_9++].join("_");}},set:function(_10,_11){if(undefined!==_10){this.content=_10;}if(_11){this._mixin(_11);}this.onBegin();this.setContent();var ret=this.onEnd();if(ret&&ret.then){return ret;}else{return this.node;}},setContent:function(){var _12=this.node;if(!_12){throw new Error(this.declaredClass+": setContent given no node");}try{_12=_8._setNodeContent(_12,this.content);}catch(e){var _13=this.onContentError(e);try{_12.innerHTML=_13;}catch(e){console.error("Fatal "+this.declaredClass+".setContent could not change content due to "+e.message,e);}}this.node=_12;},empty:function(){if(this.parseDeferred){if(!this.parseDeferred.isResolved()){this.parseDeferred.cancel();}delete this.parseDeferred;}if(this.parseResults&&this.parseResults.length){_3.forEach(this.parseResults,function(w){if(w.destroy){w.destroy();}});delete this.parseResults;}_6.empty(this.node);},onBegin:function(){var _14=this.content;if(_2.isString(_14)){if(this.cleanContent){_14=_8._secureForInnerHtml(_14);}if(this.extractContent){var _15=_14.match(/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im);if(_15){_14=_15[1];}}}this.empty();this.content=_14;return this.node;},onEnd:function(){if(this.parseContent){this._parse();}return this.node;},tearDown:function(){delete this.parseResults;delete this.parseDeferred;delete this.node;delete this.content;},onContentError:function(err){return "Error occurred setting content: "+err;},onExecError:function(err){return "Error occurred executing scripts: "+err;},_mixin:function(_16){var _17={},key;for(key in _16){if(key in _17){continue;}this[key]=_16[key];}},_parse:function(){var _18=this.node;try{var _19={};_3.forEach(["dir","lang","textDir"],function(_1a){if(this[_1a]){_19[_1a]=this[_1a];}},this);var _1b=this;this.parseDeferred=_7.parse({rootNode:_18,noStart:!this.startup,inherited:_19,scope:this.parserScope}).then(function(_1c){return _1b.parseResults=_1c;});}catch(e){this._onError("Content",e,"Error parsing in _ContentSetter#"+this.id);}},_onError:function(_1d,err,_1e){var _1f=this["on"+_1d+"Error"].call(this,err);if(_1e){console.error(_1e,err);}else{if(_1f){_8._setNodeContent(this.node,_1f,true);}}}});_8.set=function(_20,_21,_22){if(undefined==_21){console.warn("dojo.html.set: no cont argument provided, using empty string");_21="";}if(!_22){return _8._setNodeContent(_20,_21,true);}else{var op=new _8._ContentSetter(_2.mixin(_22,{content:_21,node:_20}));return op.set();}};return _8;}); \ No newline at end of file