>If anyone is seeing some problems with this let me know. When I started to
>use numElements without those fix it didn't work.
>>@@ -231,7 +231,7 @@ package org.apache.flex.core
>> public function $numElements():int
>> - return super.numElements();
>> + return super.numElements;
Hmm. I thought the Compiler knew to report an error there. Oh well, good
>> @@ -799,6 +799,8 @@ package org.apache.flex.core
>> public function internalChildren():Array
>> + if (!element) return ;
>> return element.childNodes as Array;
I would be interested to know why internalChildren got called without an
element. Elements get created pretty early.
>I think the reason that we haven't had problems with numElements is that
>one use it before. It's true that compiler should catch it even without
>using, but it didn't.
>As for the internalChildren - Sankar in his application did find one
>scenario with Tabs component where our element was undefined.
Do you have time to figure out why element is undefined? Adding defensive
code doesn't scale. Eventually it adds up to something. So if 99% of the
time the defensive code doesn't do anything we want to understand what it
would take to make it 100% so we can remove that code.
numElements works for me. The problem you found was with $numElements. I think we haven't seen a bug thus far because ContainerBase.$numElements just calls super.numElements which returns the number of elements in UIBase. Usually (always?) there's one component there, which is the internal contentView. ContainerBase.numElements, on the other hand, returns the number of elements in the contentView itself.
In short, $numElements in all scenarios I'm aware of is 1. I suppose a defined function implicitly cast to an int will return 1 as well (haven't tried it).
BTW, I see the same problem in ContainerBaseStrandChildren.$numElements and in ListBaseStrandChildren.$numElements.
Re: [1/2] git commit: [flex-asjs] [refs/heads/develop] - - Fix not working numElements - Fix failing internalChildren function when element is undefined
In my scenario I have content where numElements is greater than 1. . I'm using it to check whether I have any children apart of TabBar - it means to me that TabBar contains also TabPanel-s (content holder for each TabButton).
If numElements is failing as it's in my case in other layouts it probably should be fixed, but I won't touch it till someone will not show me cases when it's failing.
>On 2/9/17, 8:38 AM, "piotrz" <[hidden email]> wrote:
>>I think the reason that we haven't had problems with numElements is that
>>one use it before. It's true that compiler should catch it even without
>>using, but it didn't.
>>As for the internalChildren - Sankar in his application did find one
>>scenario with Tabs component where our element was undefined.
>Do you have time to figure out why element is undefined? Adding defensive
>code doesn't scale. Eventually it adds up to something. So if 99% of the
>time the defensive code doesn't do anything we want to understand what it
>would take to make it 100% so we can remove that code.
>Well I have to admit that I didn't find reason. Not sure if I found the
>to dig into that. I can create some example which allows me reproduce it
>my memory back on this one.
>Apache Flex PMC
>[hidden email] >--
>View this message in context:
>Sent from the Apache Flex Development mailing list archive at Nabble.com.