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

function AnuPortal(props){
    return props.children;
}

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