There might be a need for some changes related to this topic, but when I originally wrote this code, I assumed there were going to be instances where the "label" of a button should and should not be interpreted as HTML so that is why there are two APIs. Some platforms (Flash TextField) may have separate platform APIs for displaying strings as interpreted vs un-interpreted.
HTH, -Alex On 4/4/19, 10:24 AM, "Harbs" <harbs.li...@gmail.com> wrote: innerHTML is dangerous.[1] You definitely should not use that for “text”. Text should either be textContent[2] or innerText[3]. InnerText makes more sense from my perspective. [1]https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FAPI%2FElement%2FinnerHTML%23Security_considerations&data=02%7C01%7Caharui%40adobe.com%7C84ac324271dd4fb5a64808d6b92254ca%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636899954439569985&sdata=cOoO%2FwzYmKMe%2FOm6DE9vFdBRz1%2BE2kJ9HflLOxliCLc%3D&reserved=0 <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FAPI%2FElement%2FinnerHTML%23Security_considerations&data=02%7C01%7Caharui%40adobe.com%7C84ac324271dd4fb5a64808d6b92254ca%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636899954439569985&sdata=cOoO%2FwzYmKMe%2FOm6DE9vFdBRz1%2BE2kJ9HflLOxliCLc%3D&reserved=0> [2]https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FAPI%2FNode%2FtextContent&data=02%7C01%7Caharui%40adobe.com%7C84ac324271dd4fb5a64808d6b92254ca%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636899954439569985&sdata=cYROnytK%2FmXCD42E9HzVx25AQizH1GedKsPeMcYVKNY%3D&reserved=0 <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FAPI%2FNode%2FtextContent&data=02%7C01%7Caharui%40adobe.com%7C84ac324271dd4fb5a64808d6b92254ca%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636899954439569985&sdata=cYROnytK%2FmXCD42E9HzVx25AQizH1GedKsPeMcYVKNY%3D&reserved=0> [3]https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FAPI%2FHTMLElement%2FinnerText&data=02%7C01%7Caharui%40adobe.com%7C84ac324271dd4fb5a64808d6b92254ca%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636899954439569985&sdata=C1%2B0UMGiGgdRimh8wgj25qlb1SAuOPh855%2F5zkiR2%2BQ%3D&reserved=0 <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FAPI%2FHTMLElement%2FinnerText&data=02%7C01%7Caharui%40adobe.com%7C84ac324271dd4fb5a64808d6b92254ca%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636899954439569985&sdata=C1%2B0UMGiGgdRimh8wgj25qlb1SAuOPh855%2F5zkiR2%2BQ%3D&reserved=0> > On Apr 4, 2019, at 8:00 PM, Carlos Rovira <carlosrov...@apache.org> wrote: > > ok I'm talking about Jewel components that uses same arq as Basic since are > based on it. So, for example TextInput, TextArea, Alert, Label, CheckBox, > RadioButton, Button, and some more has text() and html() getters setters. > > I recently changed Jewel Alert to use html instead of text, I'm thinking if > I should make all Jewel components to have just one property (maybe better > "text" than "html") that can get just text or text with tags. This will > save many bytes I think > > For example in Jewel Button we have the same code, so html seems not needed > at all: > > [Bindable("textChange")] > /** > * @copy org.apache.royale.html.Label#text > * > * @langversion 3.0 > * @playerversion Flash 10.2 > * @playerversion AIR 2.6 > * @productversion Royale 0.9.4 > */ > public function get text():String > { > return (element as HTMLButtonElement).innerHTML; > } > > /** > * @private > */ > public function set text(value:String):void > { > (element as HTMLButtonElement).innerHTML = value; > this.dispatchEvent(new Event('textChange')); > } > > [Bindable("htmlChange")] > /** > * @copy org.apache.royale.html.Label#html > * > * @langversion 3.0 > * @playerversion Flash 10.2 > * @playerversion AIR 2.6 > * @productversion Royale 0.9.4 > */ > public function get html():String > { > return (element as HTMLButtonElement).innerHTML; > } > > /** > * @private > */ > public function set html(value:String):void > { > (element as HTMLButtonElement).innerHTML = value; > this.dispatchEvent(new Event('textChange')); > } > > El jue., 4 abr. 2019 a las 16:14, Harbs (<harbs.li...@gmail.com>) escribió: > >> The HTML elements have text and innerHTML which correspond to the HTML >> element properties. >> >> I’m not sure what the logic of the basic components is. >> >>> On Apr 4, 2019, at 3:18 PM, Kessler CTR Mark J < >> mark.kessler....@usmc.mil.INVALID> wrote: >>> >>> The "text" property is probably just for compatibility with the flex >> components if we are talking about things like "TextInput". Is the "text" >> property just syntax sugar / wrapping for the html property? >>> >>> >>> -Mark K >>> >>> >>> -----Original Message----- >>> From: Carlos Rovira [mailto:carlosrov...@apache.org] >>> Sent: Thursday, April 4, 2019 4:59 AM >>> To: dev@royale.apache.org >>> Subject: [Non-DoD Source] text vs html >>> >>> Hi >>> >>> in many components we have properties "text" and "html", and I was trying >>> to figure what we need this duplicate currently. >>> My bet is that just html (or text with html tags support) will be >>> sufficient. >>> Is there any need to have this double property, it seems to me not PAYG >> and >>> html supports text with more things, so not reason for this, at least >> that >>> I know >>> >>> thanks >>> >>> -- >>> Carlos Rovira >>> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C84ac324271dd4fb5a64808d6b92254ca%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636899954439569985&sdata=n8lB8YkHuPQeYVZb%2FxGb38DDX3X%2Fb%2FXepKfb9g6mG64%3D&reserved=0 >> >> > > -- > Carlos Rovira > https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%7C84ac324271dd4fb5a64808d6b92254ca%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636899954439569985&sdata=n8lB8YkHuPQeYVZb%2FxGb38DDX3X%2Fb%2FXepKfb9g6mG64%3D&reserved=0