import { createVnode, createElement } from "./createElement";
import { DOMUpdater } from "./DOMUpdater";

function Portal(props, context){
    return props.children;
}

//[Top API] ReactDOM.createPortal
export function createPortal(children, node) {
    var vnode;
    if(node.__events){
        vnode = node.__events.vnode;
    }else{
        vnode = createVnode(node);
        node.__ = vnode;
        new DOMUpdater(vnode);
    }
    var ret = createElement(Portal,{children});
    ret.portal = vnode;
    
    return ret;
}
