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

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

Issue 845283003: Allow on-* event handlers on <sky-element>. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: s p a c i n g 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
« no previous file with comments | « sky/framework/sky-button/sky-button.sky ('k') | sky/framework/sky-element/sky-element.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/sky-checkbox/sky-checkbox.sky
diff --git a/sky/framework/sky-checkbox/sky-checkbox.sky b/sky/framework/sky-checkbox/sky-checkbox.sky
index 803bc1e301f30e1e19268fc1861add431d440bda..14db2c6f0a8e8d3be8f64a4439f2ab10c38f0eb9 100644
--- a/sky/framework/sky-checkbox/sky-checkbox.sky
+++ b/sky/framework/sky-checkbox/sky-checkbox.sky
@@ -5,7 +5,10 @@
-->
<import src="/sky/framework/sky-button/sky-button.sky" as="SkyButton" />
-<sky-element name="sky-checkbox" attributes="checked:boolean">
+<sky-element
+ name="sky-checkbox"
+ attributes="checked:boolean"
+ on-mouseup="handleMouseUp">
<template>
<style>
:host {
@@ -55,10 +58,6 @@ module.exports = class extends SkyButton {
this.containerStyle = '';
this.checkStyle = '';
-
- this.addEventListener('mouseup', function() {
- this.checked = !this.checked;
- });
}
checkedChanged(oldValue, newValue) {
this.checkStyle = newValue ? 'checked' : '';
@@ -66,6 +65,9 @@ module.exports = class extends SkyButton {
highlightChanged(oldValue, newValue) {
this.containerStyle = newValue ? 'highlight' : '';
}
+ handleMouseUp() {
+ this.checked = !this.checked;
+ }
}.register();
</script>
</sky-element>
« no previous file with comments | « sky/framework/sky-button/sky-button.sky ('k') | sky/framework/sky-element/sky-element.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698