mirror of
https://github.com/Polymer/polymer.git
synced 2026-08-19 01:14:44 -05:00
Add comments. Behavior fast copy flag changed to _noAccessors.
This commit is contained in:
@@ -46,6 +46,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
}
|
||||
} else {
|
||||
this._desugarBehaviors(); // abstract
|
||||
// previously factor behavior call unrolled for perf
|
||||
for (var i=0, b; i < this.behaviors.length; i++) {
|
||||
b = this.behaviors[i];
|
||||
if (b.beforeRegister) {
|
||||
@@ -68,6 +69,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
}
|
||||
Polymer.telemetry.instanceCount++;
|
||||
this.root = this;
|
||||
// previously factor behavior call unrolled for perf
|
||||
for (var i=0, b; i < this.behaviors.length; i++) {
|
||||
b = this.behaviors[i];
|
||||
if (b.created) {
|
||||
@@ -97,6 +99,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
// IFF `lazyRegister` is 'max'
|
||||
if (settings.lazyRegister === 'max') {
|
||||
proto._desugarBehaviors(); // abstract
|
||||
// previously factor behavior call unrolled for perf
|
||||
for (var i=0, b; i < proto.behaviors.length; i++) {
|
||||
b = proto.behaviors[i];
|
||||
if (b.beforeRegister) {
|
||||
@@ -109,6 +112,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
proto._finishRegisterFeatures();
|
||||
}
|
||||
// registration extension point
|
||||
// previously factor behavior call unrolled for perf
|
||||
for (var j=0, pb; j < proto.behaviors.length; j++) {
|
||||
pb = proto.behaviors[j];
|
||||
if (pb.registered) {
|
||||
@@ -135,6 +139,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
var self = this;
|
||||
Polymer.RenderStatus.whenReady(function() {
|
||||
self.isAttached = true;
|
||||
// previously factor behavior call unrolled for perf
|
||||
for (var i=0, b; i < self.behaviors.length; i++) {
|
||||
b = self.behaviors[i];
|
||||
if (b.attached) {
|
||||
@@ -153,6 +158,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
var self = this;
|
||||
Polymer.RenderStatus.whenReady(function() {
|
||||
self.isAttached = false;
|
||||
// previously factor behavior call unrolled for perf
|
||||
for (var i=0, b; i < self.behaviors.length; i++) {
|
||||
b = self.behaviors[i];
|
||||
if (b.detached) {
|
||||
@@ -170,6 +176,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
// TODO(sorvell): consider filtering out changes to host attributes
|
||||
// note: this was barely measurable with 3 host attributes.
|
||||
this._attributeChangedImpl(name); // abstract
|
||||
// previously factor behavior call unrolled for perf
|
||||
for (var i=0, b; i < this.behaviors.length; i++) {
|
||||
b = this.behaviors[i];
|
||||
if (b.attributeChanged) {
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
});
|
||||
|
||||
Object.defineProperty(DomModule.prototype, 'constructor', {
|
||||
value: DomModule, configurable: true
|
||||
value: DomModule, configurable: true, writable: true
|
||||
});
|
||||
|
||||
// NOTE: HTMLImports polyfill does not
|
||||
|
||||
@@ -101,10 +101,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
|
||||
_mixinBehavior: function(b) {
|
||||
var n$ = Object.getOwnPropertyNames(b);
|
||||
var skipDefine = b._skipDefineProperty;
|
||||
var useAssignment = b._noAccessors;
|
||||
for (var i=0, n; (i<n$.length) && (n=n$[i]); i++) {
|
||||
if (!Polymer.Base._behaviorProperties[n] && !this.hasOwnProperty(n)) {
|
||||
if (skipDefine) {
|
||||
if (useAssignment) {
|
||||
this[n] = b[n];
|
||||
} else {
|
||||
this.copyOwnProperty(n, b, this);
|
||||
@@ -128,27 +128,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
this._prepBehavior(this);
|
||||
},
|
||||
|
||||
_doBehavior: function(name, args) {
|
||||
for (var i=0; i < this.behaviors.length; i++) {
|
||||
this._invokeBehavior(this.behaviors[i], name, args);
|
||||
}
|
||||
this._invokeBehavior(this, name, args);
|
||||
},
|
||||
|
||||
// note: repeating logic here to avoid fn call.
|
||||
_doBehaviorOnly: function(name, args) {
|
||||
for (var i=0; i < this.behaviors.length; i++) {
|
||||
this._invokeBehavior(this.behaviors[i], name, args);
|
||||
}
|
||||
},
|
||||
|
||||
_invokeBehavior: function(b, name, args) {
|
||||
var fn = b[name];
|
||||
if (fn) {
|
||||
fn.apply(this, args || Polymer.nar);
|
||||
}
|
||||
},
|
||||
|
||||
_marshalBehaviors: function() {
|
||||
for (var i=0; i < this.behaviors.length; i++) {
|
||||
this._marshalBehavior(this.behaviors[i]);
|
||||
@@ -173,7 +152,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
detached: true,
|
||||
attributeChanged: true,
|
||||
ready: true,
|
||||
_skipDefineProperty: true
|
||||
_noAccessors: true
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -37,11 +37,6 @@ setup(function() {
|
||||
Child._setAttributeToProperty = function() {};
|
||||
Child.behaviors = [];
|
||||
Child._desugarBehaviors = function() {};
|
||||
Child._doBehavior = function(name, args) {
|
||||
if (this[name]) {
|
||||
this[name].apply(this, args || []);
|
||||
}
|
||||
};
|
||||
instance = Object.create(Child);
|
||||
// make __proto__ work on IE10.
|
||||
if (!Object.__proto__) {
|
||||
|
||||
Reference in New Issue
Block a user