stdlib/widget.js
function render(element, beforeElement) {
            if (this.__destroyed === true) {
                console.warn('calling on destroyed object');
            }
            this.dispatch('beforeRender', {
                element : element,
                beforeElement : beforeElement
            });
            if (beforeElement) {
                this.element.insertBefore(beforeElement);
            } else {
                this.element.appendTo(element);
            }
            this.dispatch('render');
            return this;
        }
function render(element, beforeElement) {
            if (this.__destroyed === true) {
                console.warn('calling on destroyed object');
            }
            this.dispatch('beforeRender', {
                element : element,
                beforeElement : beforeElement
            });
            if (beforeElement) {
                this.element.insertBefore(beforeElement);
            } else {
                this.element.appendTo(element);
            }
            this.dispatch('render');
            return this;
        }
function render ( element , beforeElement ) { if ( this . __destroyed === true ) { console . warn ( 'calling on destroyed object' ) ; } this . dispatch ( 'beforeRender' , { element : element , beforeElement : beforeElement } ) ; if ( beforeElement ) { this . element . insertBefore ( beforeElement ) ; } else { this . element . appendTo ( element ) ; } this . dispatch ( 'render' ) ; return this ; }
The render method is the mechanism by which you pass a widget from
living only on memory to get into the DOM and with this into the
application flow. The recomendation is that render is the last method
of the setup of a widget, including appending its children. this is
because once a widget gets renderer, further operations cause browser
reflows, and DOM operations are slower than memory operations.
This method should not be replaced by its children.
@property render <public> [Function]
@method
@argument element <required> [JQuery] (undefined) This is the element
into which the widget will be appended.
@argument beforeElement <optional> [jQuery] (undefined) this is the element
that will be used as a reference to insert the widgets element. this argument
must be a child of the "element" argument.
@return this [Widget]
The render method is the mechanism by which you pass a widget from living only on memory to get into the DOM and with this into the application flow . The recomendation is that render is the last method of the setup of a widget including appending its children . this is because once a widget gets renderer further operations cause browser reflows and DOM operations are slower than memory operations . This method should not be replaced by its children .