royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pio...@apache.org
Subject [royale-asjs] branch develop updated: User in Label TextNode instead innerHTML for the "text" property
Date Sun, 14 Jan 2018 13:18:36 GMT
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 <piotrzarzycki21@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" <commits@royale.apache.org>'].

Mime
View raw message