// dojo.provide("plugd.Script");
(function(d){
var addCode = function(code, andAppend){
// pondering: can i do the andAppend check here? will the e.text/etc work if it's in the DOM first?
var e = d.create("script", { type:"text/javascript" }),
// jump through the cross-browser hoops:
how = "text" in e ? "text" : "textContent" in e ? "textContent" : "innerHTML" in e ? "innerHTML" : "appendChild"
;
if(how == "appendChild"){
e[how](d.doc.createTextNode(code));
}else{
e[how] = code;
}
if(andAppend){
d.doc.getElementsByTagName("head")[0].appendChild(e);
}
return e;
};
dojo.declare("dojo.Script", null, {
// summary: A Widget to wrap around JavaScript to be injected into ContentPane's
// to ensure they are executed. This is unneeded if the pane is a
// `dojox.layout.ContentPane`
//
// description:
//
// example:
// | <div dojoTpe='dojo.Script'>alert('foo');<div>
//
constructor: function(args, node){
node = d.byId(node);
if(node && node.innerHTML){
// hide the content asap
d.style(node, "display", "none");
addCode(node.innerHTML, true);
}
}
});
})(dojo);