apply simplifications available via property-first model and new sugaring (auto property-initialization and classList.enable polyfill)

This commit is contained in:
Scott Miles
2012-10-20 11:49:21 -07:00
parent afe3358c32
commit 37d75b5991
2 changed files with 4 additions and 12 deletions

View File

@@ -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);
}
}
});

View File

@@ -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;
}