import {Button} from './cmp/Button';
const slice = [].slice;
const VNode = function(ctor, props){
    this.ctor = ctor;
    this.props = props;
    this.children = [];
};
const Generic = function (tagName, props) {
    this.props = props;
    this.children = [];
    this.el = document.createElement(tagName);
};
Generic.prototype = {
    render: function(where){
        where.appendChild(this.el);
    },
    addChild: function (child) {
        child.render(this.el)
        this.children.push(child);
    }
};
const h = function(ctor, props){
    let obj;
    if(typeof ctor==='string'){
        obj = new Generic(ctor, props);
    }else {
        obj = new ctor(props);
    }
    for(let i = 2; i < arguments.length; i++) {
        obj.addChild(arguments[i]);
    }
    return obj;
    //return new VNode(ctor, props, slice.call(arguments, 2));
};
var a = [1,2,3];

var btn = (<Button>text1{()=>typeof h === 'function'?<b>text2</b>:null}<i x="2">text3</i>text4</Button>);
console.log(btn);
btn.render(document.body)
console.log("hello");
