static/ext/ext-all.js
function (instance, name) {
            var tpl = instance[name], // go for it! 99% of the time we will get it!
                owner;

            if (tpl && !tpl.isTemplate) { // tpl is just a configuration (not an instance)
                // create the template instance from the configuration:
                tpl = Ext.ClassManager.dynInstantiate('Ext.XTemplate', tpl);

                // and replace the reference with the new instance:
                if (instance.hasOwnProperty(name)) { // the tpl is on the instance
                    owner = instance;
                } else { // must be somewhere in the prototype chain
                    for (owner = instance.self.prototype; owner && !owner.hasOwnProperty(name); owner = owner.superclass) {
                    }
                }
                owner[name] = tpl;
                tpl.owner = owner;
            }
            // else !tpl (no such tpl) or the tpl is an instance already... either way, tpl
            // is ready to return

            return tpl || null;
        }
function (instance, name) {
            var tpl = instance[name], // go for it! 99% of the time we will get it!
                owner;

            if (tpl && !tpl.isTemplate) { // tpl is just a configuration (not an instance)
                // create the template instance from the configuration:
                tpl = Ext.ClassManager.dynInstantiate('Ext.XTemplate', tpl);

                // and replace the reference with the new instance:
                if (instance.hasOwnProperty(name)) { // the tpl is on the instance
                    owner = instance;
                } else { // must be somewhere in the prototype chain
                    for (owner = instance.self.prototype; owner && !owner.hasOwnProperty(name); owner = owner.superclass) {
                    }
                }
                owner[name] = tpl;
                tpl.owner = owner;
            }
            // else !tpl (no such tpl) or the tpl is an instance already... either way, tpl
            // is ready to return

            return tpl || null;
        }
Gets an `XTemplate` from an object (an instance of an {@link Ext#define}'d class).
Many times, templates are configured high in the class hierarchy and are to be
shared by all classes that derive from that base. To further complicate matters,
these templates are seldom actual instances but are rather configurations. For
example:

Ext.define('MyApp.Class', {
extraCls: 'extra-class',

someTpl: [
'<div class="{%this.emitClass(out)%}"></div>',
{

emitClass: function(out) {
out.push(this.owner.extraCls);
}
}]
});

The goal being to share that template definition with all instances and even
instances of derived classes, until `someTpl` is overridden. This method will
"upgrade" these configurations to be real `XTemplate` instances *in place* (to
avoid creating one instance per object).

The resulting XTemplate will have an `owner` reference injected which refers back
to the owning object whether that is an object which has an *own instance*, or a
class prototype. Through this link, XTemplate member functions will be able to access
prototype properties of its owning class.

@param {Object} instance The object from which to get the `XTemplate` (must be
an instance of an {@link Ext#define}'d class).
@param {String} name The name of the property by which to get the `XTemplate`.
@return {Ext.XTemplate} The `XTemplate` instance or null if not found.
@protected
@static