You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2020/05/28 11:48:25 UTC

[royale-asjs] 02/05: Fix for SimpleBinding not working sometimes when starting with 'this' + small tidyup in SimpleBinding.

This is an automated email from the ASF dual-hosted git repository.

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

commit 20dd957edf8dedeb11e6422b576f5f17b910c825
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu May 28 23:00:53 2020 +1200

    Fix for SimpleBinding not working sometimes when starting with 'this' + small tidyup in SimpleBinding.
---
 .../main/royale/org/apache/royale/binding/DataBindingBase.as   |  3 ++-
 .../src/main/royale/org/apache/royale/binding/SimpleBinding.as | 10 ++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/DataBindingBase.as b/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/DataBindingBase.as
index dd45b24..73e3f30 100644
--- a/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/DataBindingBase.as
+++ b/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/DataBindingBase.as
@@ -144,7 +144,8 @@ package org.apache.royale.binding
         {
             if (!destinationObject)
             {
-                destinationObject = _strand[bindingObject.destination[0]];
+                if (bindingObject.destination[0] == 'this') destinationObject = _strand
+                else destinationObject = _strand[bindingObject.destination[0]];
             }
 
             var destination:IStrand = destinationObject as IStrand;
diff --git a/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/SimpleBinding.as b/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/SimpleBinding.as
index 8d6934d..19884f9 100644
--- a/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/SimpleBinding.as
+++ b/frameworks/projects/Binding/src/main/royale/org/apache/royale/binding/SimpleBinding.as
@@ -269,13 +269,11 @@ public class SimpleBinding implements IBead, IDocument, IBinding
 			dispatcher.removeEventListener(eventName, changeHandler);
 
 		source = dispatcher = document[sourceID] as IEventDispatcher;
-		if (source)
-		{
+
+		if (dispatcher)
 			dispatcher.addEventListener(eventName, changeHandler);
-			destination[destinationPropertyName] = source[sourcePropertyName];
-		} else {
-			destination[destinationPropertyName] = null;
-		}
+
+		destination[destinationPropertyName] = source ? source[sourcePropertyName] : null;
 	}
 }
 }