Lively Kernel canvas
// this script is evaluated on world load= 0) {
if (string[lineS]]>
savefalsenull
truenulltrue
hmmmmmhmmmmmmmmmm14
10000.07966935556663704Wikicontroltrue
10000.017826495008431396Wikicontroltrue
10001.1538986030112328e-25Wikicontroltrue
HelperTest
RunTestfalsenull>' + result.selector;\n\t\t\tmsg += '\\n';\n\t\t\tmsg += result.err.message;\n\t\t\treturn msg;\n\t\t}).join('\\n---------\\n');\n\t\t$morph('testResult').setExtent(pt(400,20))\n\t\t$morph('testResult').setFill(Color.red);\n\t\t$morph('testResult').setTextString(failStr);\n\t} /* runFinished */"]]>nullfalse
10003.0245331064559984e-24Wikicontroltrue
10000.08646689439018025Wikicontroltrue
nulltrueExporter.stringify(x)x=stringToXML('<test><![CDATA[foobar\]\]\>baz</test>')Exporter.stringify(x)c=newXMLConverter()js=c.convertToJSON(x)c.toJSONString(js)Properties.all(document)document.TEXT_NODE baz')\nExporter.stringify(x)\n\nc=new XMLConverter()\njs=c.convertToJSON(x)\nc.toJSONString(js)\n\nProperties.all(document)\n\ndocument.TEXT_NODE"]]>truetruefalse11truetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
falsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
154
10008.339056394916646Wikicontroltrue
nullfalsetruenullfalse
XMLConverter[class]falsenullfalse
false
false
falsenullfalse
localrequirements[doit]falsetruefalse0false
initializer[doit]falsetruefalse0false
TextMorph.replaceCurrentLine[doit]falsetruefalse0false321.5-1nullnullnulltruenullfalsenulltruetrue
1true
null
null
null
nulltruetrue
-----falsetruefalse0false321.5
-1nullnullnulltruetruetrue
1true
null
null
null
nulltruetrue
Object.subclass('XMLConverter',{convertToJSON:function(xml){returnthis.storeXMLDataInto(xml,{});},storeXMLDataInto:function(xml,jsObj){jsObj.tagName=xml.tagName;$A(xml.attributes).forEach(function(attr){jsObj[attr.name]=attr.value});if(xml.childNodes.length===0)returnjsObj;jsObj.children=$A(xml.childNodes).collect(function(node){if(node.nodeType==Global.document.CDATA_SECTION_NODE){return{tagName:'cdataSection',data:node.data};}if(node.nodeType==Global.document.TEXT_NODE){return{tagName:'textNode',data:node.data};}returnthis.storeXMLDataInto(node,{});},this);returnjsObj;},toJSONString:function(jsObj,indent){if(!indent)indent='';result='{';for(varkeyinjsObj){varvalue=jsObj[key];result+='\n\t'+indent+'"'+key+'":';if(Object.isNumber(value)){result+=value;}elseif(Object.isString(value)){result+='"'+value+'"';}elseif(Object.isArray(value)){result+='['+value.collect(function(item){returnthis.toJSONString(item,indent+'\t');},this).join(',')+']';}else{result+=this.toJSONString(value,indent+'\t');}result+=',';}result+='\n'+indent+'}';returnresult;},convertToXML:function(jsObj,nsMapping,baseDoc,nsWereDeclared){if(!jsObj.tagName)thrownewError('CannotconvertJSobjectwithoutattribute"tagName"toXML!');//dealwithspecialnodesif(jsObj.tagName==='cdataSection')returnbaseDoc.createCDATASection(jsObj.data);if(jsObj.tagName==='textNode')returnbaseDoc.createTextNode(jsObj.data);//createnodevarnsDecl=nsWereDeclared?'':Properties.own(nsMapping).collect(function(prefix){returnStrings.format('xmlns:%s="%s"',prefix,nsMapping[prefix])}).join('');varnode=this.createNodeFromString(Strings.format('<%s%s/>',jsObj.tagName,nsDecl),baseDoc);//setattributesProperties.own(jsObj).reject(function(key){returnkey=='tagName'||key=='children'}).forEach(function(key){varvalue=jsObj[key];if(key.include(':')){varprefix=key.split(':')[0];varns=nsMapping[prefix];if(!ns)thrownewError('JSobjectincludesnodewithtagnamehavingaNSprefixbuttheNScannotbefoundinthensMapping!');node.setAttributeNS(ns,key,value);}else{node.setAttribute(key,value);}})//addchildnodesjsObj.children&&jsObj.children.forEach(function(childJsObj){node.appendChild(this.convertToXML(childJsObj,nsMapping,baseDoc,true));},this);returnnode;},createNodeFromString:function(string,baseDoc){returnbaseDoc.adoptNode(newDOMParser().parseFromString(string,"text/xml").documentElement);},});', jsObj.tagName, nsDecl), baseDoc);\n\t\n\t// set attributes\n\tProperties.own(jsObj)\n\t\t.reject(function(key) { return key == 'tagName' || key == 'children' })\n\t\t.forEach(function(key) {\n\t\t\tvar value = jsObj[key];\n\t\t\tif (key.include(':')) {\n\t\t\t\tvar prefix = key.split(':')[0];\n\t\t\t\tvar ns = nsMapping[prefix];\n\t\t\t\tif (!ns) throw new Error('JS object includes node with tagname having a NS prefix but the NS cannot be found in the nsMapping!');\n\t\t\t\tnode.setAttributeNS(ns, key, value);\n\t\t\t} else {\n\t\t\t\tnode.setAttribute(key, value);\n\t\t\t}\n\t\t})\n\t\n\t// add childnodes\n\tjsObj.children && jsObj.children.forEach(function(childJsObj) {\n\t\tnode.appendChild(this.convertToXML(childJsObj, nsMapping, baseDoc, true));\n\t}, this);\n\treturn node;\n},\n\ncreateNodeFromString: function(string, baseDoc) {\n\treturn baseDoc.adoptNode(new DOMParser().parseFromString(string, \"text/xml\").documentElement);\n},\n\n});"]]>90truetrue2000000', jsObj.tagName, nsDecl), baseDoc);\n\t\n\t// set attributes\n\tProperties.own(jsObj)\n\t\t.reject(function(key) { return key == 'tagName' || key == 'children' })\n\t\t.forEach(function(key) {\n\t\t\tvar value = jsObj[key];\n\t\t\tif (key.include(':')) {\n\t\t\t\tvar prefix = key.split(':')[0];\n\t\t\t\tvar ns = nsMapping[prefix];\n\t\t\t\tif (!ns) throw new Error('JS object includes node with tagname having a NS prefix but the NS cannot be found in the nsMapping!');\n\t\t\t\tnode.setAttributeNS(ns, key, value);\n\t\t\t} else {\n\t\t\t\tnode.setAttribute(key, value);\n\t\t\t}\n\t\t})\n\t\n\t// add childnodes\n\tjsObj.children && jsObj.children.forEach(function(childJsObj) {\n\t\tnode.appendChild(this.convertToXML(childJsObj, nsMapping, baseDoc, true));\n\t}, this);\n\treturn node;\n},\n\ncreateNodeFromString: function(string, baseDoc) {\n\treturn baseDoc.adoptNode(new DOMParser().parseFromString(string, \"text/xml\").documentElement);\n},\n\n});"]]>truetrue
1truetruetrue
Browseworld...falsenullfalsetrue
Pushchangesbackfalsenullfalsefalse
Refreshfalsenullfalsetrue
Evalonfalsenullfalsetrue
Sortfalsenullfalsetrue
truetruenullfalsenullnullnullnullfalsenull47