From: Alan Knowles Date: Sun, 8 Apr 2012 06:48:22 +0000 (+0800) Subject: builder.html.js X-Git-Url: http://git.roojs.org/?a=commitdiff_plain;h=94093967e922d89c3e46480be36ee2ddf7857375;p=app.Builder.js builder.html.js --- diff --git a/builder.html.js b/builder.html.js index 10bf153df..625272c7a 100644 --- a/builder.html.js +++ b/builder.html.js @@ -10,21 +10,26 @@ Builder = { scriptTag : false, + id : 1, + render : function(data) { // for debugging //console.log(data); return; - if (!scriptTag) { - - this.scriptTag = document.body.appendChild(document.body.createChild('script')); - this.scriptTag.setAttribute('language','text/javascript'); - - + if (scriptTag) { + document.body.removeChild(scriptTag); + scriptTag = false; } + this.scriptTag = document.body.appendChild(document.body.createElement('script')); + this.scriptTag.setAttribute('language','text/javascript'); + + this.id++; + document.body.createCDATA('Builder._src_' + this.id = JSON.stringify(data)); + this.scriptTag.innerHTML = "_Builder." - this.tree = data; + this.tree = Builder['_src' + this.id]; MODULE = { isBuilder : true }; _this = MODULE; if (!Builder.click) {