Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Unified Diff: sky/framework/sky-button/sky-button.sky

Issue 836923002: Automate reflected properties in SkyElement. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/framework/sky-button/sky-button.sky
diff --git a/sky/framework/sky-button/sky-button.sky b/sky/framework/sky-button/sky-button.sky
index 2c747b4c8a40b10e87a1212652d41c8ea6d15701..b42ed19419f4e537c088a5a26c25fd5ae486634d 100644
--- a/sky/framework/sky-button/sky-button.sky
+++ b/sky/framework/sky-button/sky-button.sky
@@ -5,7 +5,7 @@
-->
<import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" />
-<sky-element name="sky-button">
+<sky-element name="sky-button" attributes="highlight:boolean">
<template>
<style>
:host {
@@ -21,29 +21,23 @@
background-color: orange;
}
</style>
- <content></content>
+ <content />
</template>
<script>
module.exports = class extends SkyElement {
created() {
this.tabIndex = 0; // Make focusable.
- this.setHighlight(false);
this.addEventListener("mousedown", function() {
- this.setHighlight(true);
+ this.highlight = true;
});
this.addEventListener("mouseup", function() {
- this.setHighlight(false);
+ this.highlight = false;
});
this.addEventListener("mouseout", function() {
- this.setHighlight(false);
+ this.highlight = false;
});
}
- setHighlight(newValue) {
- // Set both a property and an attribute to keep both parents happy.
- this.setAttribute('highlight', newValue);
- this.highlight = newValue;
- }
}.register();
</script>
</sky-element>
« no previous file with comments | « no previous file | sky/framework/sky-checkbox/sky-checkbox.sky » ('j') | sky/framework/sky-element/sky-element.sky » ('J')

Powered by Google App Engine
This is Rietveld 408576698