Skip to content

0.2.2 u extend

Ivan S Glazunov edited this page Feb 20, 2015 · 3 revisions

Extend?

All elements are extensions of Prototype.

Each element has the option .constructor, which you can override when inheritance. It contains the build process makes the element element.

Each element has the option .return, which specifies what will be returned by the constructor.

The extension is with the argument of the TInjector or without.

Without TInjector
var myTag = div('.myTag')().extend();
myTag()().render(console.log);
<div class="myTag"></div>
With TInjector

Here we simply disable return constructor method .content.

var injector = function(parent) {
    this.return = function() { return this; };
};
var myTag = div('.myTag')().extend(injector);
myTag().render(console.log);
<div class="myTag"></div>

Clone this wiki locally