You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/12/19 03:51:21 UTC

[royale-asjs] branch develop updated: add change detection since some apps expect it. Should fix #631

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

aharui 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 08c65e6  add change detection since some apps expect it.  Should fix #631
08c65e6 is described below

commit 08c65e63f2a3dc8cb08c73d928620064489875d2
Author: Alex Harui <ah...@apache.org>
AuthorDate: Wed Dec 18 19:50:59 2019 -0800

    add change detection since some apps expect it.  Should fix #631
---
 .../src/main/royale/spark/components/TextInput.as  | 24 ++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/TextInput.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/TextInput.as
index 70115a3..21a6f92 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/TextInput.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/TextInput.as
@@ -306,24 +306,36 @@ public class TextInput extends SkinnableTextBase
     }
     override public function set text(value:String):void
     {
+        var changed:Boolean = false;
         // BEGIN - this code shouldn't exist once SkinnableTextBase is fixed
         COMPILE::SWF
 		{
-			inSetter = true;
-			ITextModel(model).text = value;
-			inSetter = false;
+            if (value != ITextModel(model).text)
+            {
+    			inSetter = true;
+    			ITextModel(model).text = value;
+    			inSetter = false;
+                changed = true;
+            }
 		}
 		
 		COMPILE::JS
 		{
-			(element as HTMLInputElement).value = value;
+            if (value != (element as HTMLInputElement).value)
+            {
+    			(element as HTMLInputElement).value = value;
+                changed = true;
+            }
 		}
         // END
 
       /*  super.text = value; */
         // Trigger bindings to textChanged.
-        dispatchEvent(new Event("textChanged"));
-	dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
+        if (changed)
+        {
+            dispatchEvent(new Event("textChanged"));
+            dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));            
+        }
     }
 	
     private var _editable:Boolean = true;