* [jsfm] support return values in fireEvent

Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/523abfee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/523abfee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/523abfee

Branch: refs/heads/0.16-dev
Commit: 523abfeefa366d796bd16f678c19501c1374bbb8
Parents: 8130b5c
Author: Hanks <zhanghan...@gmail.com>
Authored: Wed Jul 26 16:23:22 2017 +0800
Committer: Hanks <zhanghan...@gmail.com>
Committed: Wed Jul 26 16:23:22 2017 +0800

----------------------------------------------------------------------
 html5/runtime/vdom/element.js | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/523abfee/html5/runtime/vdom/element.js
----------------------------------------------------------------------
diff --git a/html5/runtime/vdom/element.js b/html5/runtime/vdom/element.js
index 9ecff04..44aded2 100644
--- a/html5/runtime/vdom/element.js
+++ b/html5/runtime/vdom/element.js
@@ -394,23 +394,26 @@ Object.assign(Element.prototype, {
    * @return {} anything returned by handler function
    */
   fireEvent (type, e, isBubble) {
+    let result = null
     let isStopPropagation = false
     const handler = this.event[type]
     if (handler && e) {
       e.stopPropagation = () => {
         isStopPropagation = true
       }
-      handler.call(this, e)
+      result = handler.call(this, e)
     }
 
-    if (isStopPropagation) {
-      return
-    }
-
-    if (isBubble && BUBBLE_EVENTS.includes(type) && this.parentNode && 
this.parentNode.fireEvent) {
+    if (!isStopPropagation
+      && isBubble
+      && BUBBLE_EVENTS.includes(type)
+      && this.parentNode
+      && this.parentNode.fireEvent) {
       e.currentTarget = this.parentNode
       this.parentNode.fireEvent(type, e, isBubble)
     }
+
+    return result
   },
 
   /**

Reply via email to