mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
apply simplifications available via property-first model and new sugaring (auto property-initialization and classList.enable polyfill)
This commit is contained in:
@@ -14,16 +14,12 @@
|
||||
</template>
|
||||
<script>
|
||||
this.component({
|
||||
created: function() {
|
||||
this.srcAttributeChanged();
|
||||
this.activeAttributeChanged();
|
||||
},
|
||||
prototype: {
|
||||
srcAttributeChanged: function() {
|
||||
srcChanged: function() {
|
||||
this.$.icon.src = this.src;
|
||||
},
|
||||
activeAttributeChanged: function() {
|
||||
this.classList[this.active ? 'add' : 'remove']('selected');
|
||||
activeChanged: function() {
|
||||
this.classList.enable('selected', this.active);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -11,12 +11,8 @@ license that can be found in the LICENSE file.
|
||||
</template>
|
||||
<script>
|
||||
this.component({
|
||||
created: function(inSuper) {
|
||||
this.srcAttributeChanged();
|
||||
},
|
||||
prototype: {
|
||||
// note: this is called asyncronously. can we live with this?
|
||||
srcAttributeChanged: function() {
|
||||
srcChanged: function() {
|
||||
this.$.icon.style.backgroundImage =
|
||||
this.src ? 'url(' + this.src + ')' : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user