ampersand-view.js
function (context, templateArg) {
        var template = templateArg || this.template;
        if (!template) throw new Error('Template string or function needed.');
        var newDom = isString(template) ? template : template.call(this, context || this);
        if (isString(newDom)) newDom = domify(newDom);
        var parent = this.el && this.el.parentNode;
        if (parent) parent.replaceChild(newDom, this.el);
        if (newDom.nodeName === '#document-fragment') throw new Error('Views can only have one root element, including comment nodes.');
        this.el = newDom;
        return this;
    }
function (context, templateArg) {
        var template = templateArg || this.template;
        if (!template) throw new Error('Template string or function needed.');
        var newDom = isString(template) ? template : template.call(this, context || this);
        if (isString(newDom)) newDom = domify(newDom);
        var parent = this.el && this.el.parentNode;
        if (parent) parent.replaceChild(newDom, this.el);
        if (newDom.nodeName === '#document-fragment') throw new Error('Views can only have one root element, including comment nodes.');
        this.el = newDom;
        return this;
    }
function ( context , templateArg ) { var template = templateArg || this . template ; if ( ! template ) throw new Error ( 'Template string or function needed.' ) ; var newDom = isString ( template ) ? template : template . call ( this , context || this ) ; if ( isString ( newDom ) ) newDom = domify ( newDom ) ; var parent = this . el && this . el . parentNode ; if ( parent ) parent . replaceChild ( newDom , this . el ) ; if ( newDom . nodeName === '#document-fragment' ) throw new Error ( 'Views can only have one root element, including comment nodes.' ) ; this . el = newDom ; return this ; }
Shortcut for doing everything we need to do to render and fully replace current root element. Either define a `template` property of your view or pass in a template directly. The template can either be a string or a function. If it's a function it will be passed the `context` argument.
Shortcut for doing everything we need to do to render and fully replace current root element . Either define a template property of your view or pass in a template directly . The template can either be a string or a function . If it s a function it will be passed the context argument .