What happens if the html property is set? In that case, I think the textNode 
does not reference anything valid.

That’s probably broken wither way though…

> On Jan 3, 2020, at 7:55 AM, Alex Harui <aha...@adobe.com.INVALID> wrote:
> 
> I noticed that "if (textNode)" the other day and wondered why it was there 
> but didn't have time to look.  If you have time, it might be worth going back 
> through history to see if was added for some reason.
> 
> -Alex
> 
> On 1/2/20, 8:38 PM, "Greg Dove" <greg.d...@gmail.com 
> <mailto:greg.d...@gmail.com>> wrote:
> 
>    I plan to gradually work on a comprehensive set of unit-ish tests for
>    Bindings (it's less easy than other things, but I believe I have an
>    approach to do it which will work as unit style tests), from the ground up.
> 
>    I started looking at this today, just with simple bindings and first up
>    comparing between swf and js for a binding into Label text, basically
>    nothing more than:
> 
>    in mxml code block:
>     [Bindable]
>      public var labelText:String;
> 
>    in mxml tags:
>     <js:Label localId="testLabel" text="{labelText}" />
> 
>    the first test was to compare startup values without having set labelText
>    to anything. (initBindings only)
> 
>    On swf it is empty string and in javascript it is null.
> 
>    The reason for that is here :
>    
> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Froyale-asjs%2Fblob%2F093c01e15d04d01cd155a24c5873de32ff273148%2Fframeworks%2Fprojects%2FBasic%2Fsrc%2Fmain%2Froyale%2Forg%2Fapache%2Froyale%2Fhtml%2FLabel.as%23L114&amp;data=02%7C01%7Caharui%40adobe.com%7Ce473c7f13506488b105f08d79006cd79%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637136231239625601&amp;sdata=YiB0UhRvrqc%2BYgSkErMdgXdk%2BG%2Bmpv31YH%2BCaI%2FlTx8%3D&amp;reserved=0
>  
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Froyale-asjs%2Fblob%2F093c01e15d04d01cd155a24c5873de32ff273148%2Fframeworks%2Fprojects%2FBasic%2Fsrc%2Fmain%2Froyale%2Forg%2Fapache%2Froyale%2Fhtml%2FLabel.as%23L114&amp;data=02%7C01%7Caharui%40adobe.com%7Ce473c7f13506488b105f08d79006cd79%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637136231239625601&amp;sdata=YiB0UhRvrqc%2BYgSkErMdgXdk%2BG%2Bmpv31YH%2BCaI%2FlTx8%3D&amp;reserved=0>
> 
>    At first glance, it looks like the following could be changed (see code
>    snippet below):
>    a) the 'if (textNode)' conditional wrapper should be able to be removed.
>    (textNode is created during construction, so should always exist I think?)
>    b) we could probably remove the local _text private var because (as per [a]
>    above) storage could be in the  textNode.nodeValue directly.
>    textNode.nodeValue = value; converts null to empty string so if the private
>    _text var was completely removed, then the getter could simply return
>    textNode.nodeValue instead of _text. This change would then match swf
>    behaviour for set null, get empty string from Label text.
> 
>    inside set text(value:String):void {....
> 
>    if (textNode)
>          {
>              _text = value;
>             textNode.nodeValue = value;
>             this.dispatchEvent('textChange');
>           }
> 
>    Does anyone see any issues with that?
> 
>    Thanks,
>    Greg

Reply via email to