royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject [royale-asjs] branch develop updated: Patched event bubbling on the JS/HTML platform.
Date Tue, 30 Jan 2018 19:52:09 GMT
This is an automated email from the ASF dual-hosted git repository.

pent pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 34dc31a  Patched event bubbling on the JS/HTML platform.
34dc31a is described below

commit 34dc31ac7ba5e2ffb59016e9c6e6b163a26357c6
Author: Peter Ent <pent@apache.org>
AuthorDate: Tue Jan 30 14:54:40 2018 -0500

    Patched event bubbling on the JS/HTML platform.
---
 .../org/apache/royale/core/HTMLElementWrapper.as       | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/HTMLElementWrapper.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/HTMLElementWrapper.as
index 77ab263..587d190 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/HTMLElementWrapper.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/HTMLElementWrapper.as
@@ -18,6 +18,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.core
 {
+	import org.apache.royale.events.IEventDispatcher;
+
     COMPILE::SWF
     {
         import flash.display.Sprite;
@@ -286,6 +288,9 @@ package org.apache.royale.core
                 }
             }
             var source:Object = this.getActualDispatcher_(eventType);
+			if (e.bubbles) {
+				return dispatchBubblingEvent(source, e);
+			}
             if (source == this)
             {
                 return super.dispatchEvent(e);
@@ -293,5 +298,18 @@ package org.apache.royale.core
             
             return source.dispatchEvent(e);
         }
+		
+		public function dispatchBubblingEvent(source:Object, e:Object):Boolean
+		{
+			// build the ancestors tree without setting the actual parentEventTarget
+			var ancestorsTree:Array = [];
+			var t:IEventDispatcher = source["parent"] as IEventDispatcher;
+			while (t != null) {
+				ancestorsTree.push(t);
+				t = t["parent"] as IEventDispatcher;
+			}
+			
+			return goog.events.EventTarget.dispatchEventInternal_(source, e, ancestorsTree);
+		}
 	}
 }

-- 
To stop receiving notification emails like this one, please contact
pent@apache.org.

Mime
View raw message