From e69602e2c33b0f364451630ea05011fe7d1426b1 Mon Sep 17 00:00:00 2001 From: Scott Miles Date: Fri, 30 Nov 2012 17:07:50 -0800 Subject: [PATCH 1/4] refactored desugar/extend code, implement bindDelegates --- src/g-component.html | 167 +++++++++++++++++++++++-------------------- 1 file changed, 91 insertions(+), 76 deletions(-) diff --git a/src/g-component.html b/src/g-component.html index b9b001dd37..e4ce406dc5 100644 --- a/src/g-component.html +++ b/src/g-component.html @@ -6,7 +6,7 @@ + } + }; + + function bindAccumulatedEvents(inNode, inEvents) { + var fn = __.bind(inNode); + for (var n in inEvents) { + log.events && console.log('[%s] bindAccumulatedEvents: addEventListener("%s", __)', inNode.localName, n); + inNode.addEventListener(n, fn); + } + }; + + function __(inEvent) { + var on = prefix + inEvent.type; + log.events && console.group("[%s]: __ [%s]", this.localName, on); + var t = inEvent.target; + while (t && t != this) { + t = deref(t); + log.events && console.dir(t); + if (t.attributes) { + var h = t.getAttribute(on); + if (h) { + var c = findController(t); + log.events && console.log('found handler [%s] for controller', h, c); + if (c == this) { + log.events && console.log('invoking [%s]', h); + if (this.$protected[h]) { + this.$protected[h](inEvent, inEvent.detail, t); + } + } + } + } + t = t.parentNode; + } + log.events && console.groupEnd(); + }; + \ No newline at end of file diff --git a/src/g-icon.html b/src/g-icon.html index f2339622a0..ca6995828a 100644 --- a/src/g-icon.html +++ b/src/g-icon.html @@ -16,7 +16,7 @@ opacity: 0.8; } - .icon { + #icon { width: 21px; height: 21px; cursor: pointer; @@ -24,9 +24,13 @@ background-size: contain; } -
+
- diff --git a/src/g-menu.html b/src/g-menu.html index 0bcd6f898b..0a6149f015 100644 --- a/src/g-menu.html +++ b/src/g-menu.html @@ -5,7 +5,7 @@ * license that can be found in the LICENSE file. */ --> - +