mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Make classList a getter so it can be lazy; dom mutation api's only cause distribution on parent.
This commit is contained in:
@@ -29,7 +29,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
if (this.patch) {
|
||||
this.patch();
|
||||
}
|
||||
this.classList = new DomApi.ClassList(this);
|
||||
};
|
||||
|
||||
DomApi.prototype = {
|
||||
@@ -369,8 +368,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
}
|
||||
},
|
||||
|
||||
// TODO(sorvell): make Polymer utils use these...
|
||||
|
||||
setAttribute: function(name, value) {
|
||||
this.node.setAttribute(name, value);
|
||||
this._distributeParent();
|
||||
@@ -383,12 +380,22 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
|
||||
_distributeParent: function() {
|
||||
if (this.parentNode && this.parentNode.shadyRoot) {
|
||||
this.parentNode.distributeContent();
|
||||
this._lazyDistribute(this.parentNode);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Object.defineProperty(DomApi.prototype, 'classList', {
|
||||
get: function() {
|
||||
if (!this._classList) {
|
||||
this._classList = new DomApi.ClassList(this);
|
||||
}
|
||||
return this._classList;
|
||||
},
|
||||
configurable: true
|
||||
});
|
||||
|
||||
DomApi.ClassList = function(host) {
|
||||
this.domApi = host;
|
||||
this.node = host.node;
|
||||
|
||||
Reference in New Issue
Block a user