mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
API docs for templatizer-behavior
This commit is contained in:
parent
3f0a1977b9
commit
1c29973cf0
@ -77,8 +77,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* @memberof Polymer
|
||||
*/
|
||||
let Templatizer = {
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Generates an anonymous `TemplateInstance` class (stored as `this.ctor`)
|
||||
* for the provided template. This method should be called once per
|
||||
* template to prepare an element for stamping the template, followed
|
||||
* by `stamp` to create new instances of the template.
|
||||
*
|
||||
* @param {HTMLTemplateElement} template Template to prepare
|
||||
* @return {TemplateInstance} Description
|
||||
*/
|
||||
templatize(template) {
|
||||
this._templatizerTemplate = template;
|
||||
@ -89,14 +96,31 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
notifyInstanceProp: this._notifyInstancePropV2
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Creates an instance of the template prepared by `templatize`. The object
|
||||
* returned is an instance of the anonymous class generated by `templatize`
|
||||
* whose `root` property is a document fragment containing newly cloned
|
||||
* template content, and which has property accessors corresponding to
|
||||
* properties referenced in template bindings.
|
||||
*
|
||||
* @param {Object=} model Object containing initial property values to
|
||||
* populate into the template bindings.
|
||||
*/
|
||||
stamp(model) {
|
||||
return new this.ctor(model);
|
||||
},
|
||||
|
||||
/**
|
||||
* TODOC
|
||||
* Returns the template "model" (`TemplateInstance`) associated with
|
||||
* a given element, which serves as the binding scope for the template
|
||||
* instance the element is contained in. A template model should be used
|
||||
* to manipulate data associated with this template instance.
|
||||
*
|
||||
* @method modelForElement
|
||||
* @param {HTMLElement} el Element for which to return a template model.
|
||||
* @return {TemplateInstanceBase} Model representing the binding scope for
|
||||
* the element.
|
||||
*/
|
||||
modelForElement(el) {
|
||||
return Polymer.Templatize.modelForElement(this._templatizerTemplate, el);
|
||||
|
Loading…
Reference in New Issue
Block a user