import '../types';

/**
 * Takes care of rendering a Native DOM-Element
 *
 * @class
 * @implements {VNodeRenderer}
 */
export const NativeRenderer = {
    /**
     * @return {VNodeRendererMeta}
     */
    meta(){
        return {
            hasChildren: false,// Counter intiutitive, but this is false as CSX will never manage children of a premade DOM-element
            isNode: true,
        };
    },
    
    /**
     * @param {VRenderItem} item
     */
    create(item){
        return item.vnode;
    },
    
    /**
     * @param {VRenderItem} item
     */
    update(item){
        if(item.old && item.old!==item.vnode){
            item.host.replaceWith(item.vnode);
        }
        return;
    }
};
