You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by pi...@apache.org on 2018/01/14 13:18:36 UTC

[royale-asjs] branch develop updated: User in Label TextNode instead innerHTML for the "text" property

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

piotrz 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 f8621d6  User in Label TextNode instead innerHTML for the "text" property
f8621d6 is described below

commit f8621d6ed8a8d119d3b2aaad409080442b254f6c
Author: Piotr Zarzycki <pi...@gmail.com>
AuthorDate: Sun Jan 14 14:18:28 2018 +0100

    User in Label TextNode instead innerHTML for the "text" property
---
 .../src/main/royale/org/apache/royale/html/Label.as  | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/Label.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/Label.as
index 12fa938..7502e21 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/Label.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/Label.as
@@ -72,6 +72,12 @@ package org.apache.royale.html
 			super();
 		}
 
+        COMPILE::JS
+        protected var textNode:Text;
+
+        COMPILE::JS
+        private var _text:String = "";
+
         [Bindable("textChange")]
         /**
          *  The text to display in the label.
@@ -89,7 +95,7 @@ package org.apache.royale.html
             }
             COMPILE::JS
             {
-                return element.innerHTML;
+                return _text;
             }
 		}
 
@@ -104,8 +110,12 @@ package org.apache.royale.html
             }
             COMPILE::JS
             {
-                this.element.innerHTML = value;
-                this.dispatchEvent('textChange');
+                if (textNode)
+                {
+                    _text = value;
+                    textNode.nodeValue = value;
+                    this.dispatchEvent('textChange');
+                }
             }
 
 		}
@@ -165,6 +175,10 @@ package org.apache.royale.html
         override protected function createElement():WrappedHTMLElement
         {
 			addElementToWrapper(this,'span');
+
+            textNode = document.createTextNode(_text) as Text;
+            element.appendChild(textNode);
+
             element.style.whiteSpace = "nowrap";
 
             className = "Label";

-- 
To stop receiving notification emails like this one, please contact
['"commits@royale.apache.org" <co...@royale.apache.org>'].