dojox.layout.ContentPane._setContent
dojo.require("dojox.layout.ContentPane");
defined in dojox/layout/ContentPane.js
Usage
function (cont) (view source)
var styles = [];// init vars if(dojo.isString(cont)){ if(this.adjustPaths && this.href){ cont = adjustHtmlPaths(this.href, cont); } if(this.cleanContent){ cont = secureForInnerHtml(cont); } if(this.renderStyles || this.cleanContent){ cont = snarfStyles(this.href, cont, styles); } // because of a bug in IE, script tags that is first in html hierarchy doesnt make it into the DOM // when content is innerHTML'ed, so we can't use dojo.query to retrieve scripts from DOM if(this.executeScripts){ var _t = this, code, byRef = { downloadRemote: true, errBack:function(e){ _t._onError.call(_t, 'Exec', 'Error downloading remote script in "'+_t.id+'"', e); } }; cont = snarfScripts(cont, byRef); code = byRef.code; } // rationale for this block: // if containerNode/domNode is a table derivate tag, some browsers dont allow innerHTML on those var node = (this.containerNode || this.domNode), pre = post = '', walk = 0; switch(node.nodeName.toLowerCase()){ case 'tr': pre = '<tr>'; post = '</tr>'; walk += 1;//fallthrough case 'tbody': case 'thead':// children of THEAD is of same type as TBODY pre = '<tbody>' + pre; post += '</tbody>'; walk += 1;// falltrough case 'table': pre = '<table>' + pre; post += '</table>'; walk += 1; break; } if(walk){ var n = node.ownerDocument.createElement('div'); n.innerHTML = pre + cont + post; do{ n = n.firstChild; }while(--walk); cont = n.childNodes; } } // render the content dijit.layout.ContentPane.prototype._setContent.call(this, cont); // clear old stylenodes from the DOM if(this._styleNodes && this._styleNodes.length){ while(this._styleNodes.length){ dojo._destroyElement(this._styleNodes.pop()); } } // render new style nodes if(this.renderStyles && styles && styles.length){ this._renderStyles(styles); } if(this.executeScripts && code){ if(this.cleanContent){ // clean JS from html comments and other crap that browser // parser takes care of in a normal page load code = code.replace(/(<!--|(?:\/\/)?-->|<!\[CDATA\[|\]\]>)/g|>, ''); } if(this.scriptHasHooks){ // replace _container_ with dijit.byId(this.id) code = code.replace(/_container_(?!\s*=[^=])/g|>, dijit._scopeName + ".byId('"+this.id+"')"); } try{ evalInGlobal(code, (this.containerNode || this.domNode)); }catch(e){ this._onError('Exec', 'Error eval script in '+this.id+', '+e.message, e); } }
parameter | type | description |
---|---|---|
cont |