MCPcopy
hub / github.com/jabbany/CommentCoreLibrary / _

Function _

src/scripting/Unpacker.js:4–34  ·  view source on GitHub ↗
(type, props, children, callback)

Source from the content-addressed store, hash-verified

2(function(){
3 /** This is the DOM Manipulation Library **/
4 var _ = function (type, props, children, callback) {
5 var elem = null;
6 if (type === "text") {
7 return document.createTextNode(props);
8 } else if(type === "svg"){
9 elem = document.createElementNS("http://www.w3.org/2000/svg", "svg");
10 }else {
11 elem = document.createElement(type);
12 }
13 for(var n in props){
14 if(n !== "style" && n !== "className"){
15 elem.setAttribute(n, props[n]);
16 }else if(n === "className"){
17 elem.className = props[n];
18 }else{
19 for(var x in props.style){
20 elem.style[x] = props.style[x];
21 }
22 }
23 }
24 if (children) {
25 for(var i = 0; i < children.length; i++){
26 if(children[i] != null)
27 elem.appendChild(children[i]);
28 }
29 }
30 if (callback && typeof callback === "function") {
31 callback(elem);
32 }
33 return elem;
34 };
35 var ScriptingContext = CCLScripting.prototype.ScriptingContext;
36 ScriptingContext.prototype.Unpack.TextField = function(stage, data, ctx){
37 this.DOM = _("div",{

Callers 1

Unpacker.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected