You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2020/07/12 15:13:31 UTC

[royale-asjs] 01/02: Revert "basic-imagebutton: fix control nesting img inside a button when there is html input image"

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

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

commit c1dd7bb53ea5d712a29caee938b07c2ae8548988
Author: Harbs <ha...@in-tools.com>
AuthorDate: Sun Jul 12 18:05:57 2020 +0300

    Revert "basic-imagebutton: fix control nesting  img inside a button when there is html input image"
    
    This reverts commit 4377b0b3c4e7521d132a3cb72a18bedcc5aacb6a.
---
 .../main/royale/org/apache/royale/html/ImageButton.as | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/ImageButton.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/ImageButton.as
index 407ceb3..5b3c2d3 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/ImageButton.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/ImageButton.as
@@ -60,8 +60,8 @@ package org.apache.royale.html
 		COMPILE::JS
         override protected function createElement():WrappedHTMLElement
         {
-			addElementToWrapper(this,'input');
-            element.setAttribute('type', 'image');
+			addElementToWrapper(this,'button');
+            element.setAttribute('type', 'button');
             return element;
         }
 
@@ -94,19 +94,16 @@ package org.apache.royale.html
             {
                 if(!_imageElement)
                 {
-                    (element as HTMLInputElement).src = url;
-                    _imageElement = (element as HTMLInputElement);
-                }
-                if (_imageElement && url)
-                {
-                    (_imageElement as HTMLInputElement).src = url;
-                }
+                    _imageElement = document.createElement("img") as HTMLImageElement;
+                    element.appendChild(_imageElement);
+                }                
+                (_imageElement as HTMLImageElement).src = url;
             }
 
 			dispatchEvent(new Event("srcChanged"));
         }
 
-		COMPILE::JS
+		COMPILE::JS{
         private var _imageElement:Element;
 		/**
 		 *  Element image. HTMLImageElement.
@@ -118,10 +115,10 @@ package org.apache.royale.html
          *  @royaleignorecoercion org.apache.royale.core.IImageButton#imageElement
          *  @royaleignorecoercion Element
          */
-        COMPILE::JS
 		public function get imageElement():Element
 		{
 			return _imageElement;
 		}
+        }
 	}
 }