Because setClassNames can be expensive, we only want to do it if we have to.  
The component lifecycle is designed for setting lots of properties before 
adding a component to its parent.  There is a call to setClassNames in 
addedToParent for that reason, so other calls to set the className shouldn't 
bother to do all of that work.

To me, it is far more worrisome that the parent property is undefined.  We need 
to understand why that is the case.  Lots of other things could break due to 
that.  If you look at the component's element and check the element's 
parentNode, is it defined?  If so, then the parent getter should not be 
returning undefined.  Step into the parent getter and try to see why.

-Alex

On 5/1/18, 2:05 AM, "Piotr Zarzycki" <piotrzarzyck...@gmail.com> wrote:

    Alex,
    
    I did more experiments to that, but not sure whether it's ok. In those two
    places I had parent - undefined [1] (UIBase) [2] (ClassSelectorList). As
    you can see I commented out those condition and everything started to work
    properly.
    
    The question is - Why those condition even there here ? Did you or Carlos
    had and scenario where something was crashing without it ?
    
    [1] 
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.apache.org%2FOTab&data=02%7C01%7Caharui%40adobe.com%7Ce2e3e44ca87a4d025c6208d5af42afdd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636607623322558881&sdata=0qoiIUEIyA4DCoVF1BrHBSFVP1IOrLS9H95d35qwstk%3D&reserved=0
    [2] 
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.apache.org%2FSv1K&data=02%7C01%7Caharui%40adobe.com%7Ce2e3e44ca87a4d025c6208d5af42afdd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636607623322568889&sdata=G6T9atRqzQwDOtPEjp6mkGRUXZE%2FZy2yY%2F95leIPQXo%3D&reserved=0
    
    Thanks,
    Piotr
    
    2018-04-29 20:02 GMT+02:00 Piotr Zarzycki <piotrzarzyck...@gmail.com>:
    
    > Alex,
    >
    > I did look into that but unfortunately adding ClassListSelector didn't
    > change anything. Still setting className dynamically won't change it
    > because parent in UIBase is undefined. I did find that loop while was
    > infinite in some circumstances. I have pushed fix, not sure if it's
    > correct.
    >
    > You were saying that parent in your browser was not undefined. I did check
    > even on my Mac on Safari and in UIBase it's undefined all the time. Maybe
    > states are messing up with something and current system do not handle
    > everything as it was before.
    >
    > I updated website [1] with committed changes. Switching between sub pages
    > reproduce the issue.
    >
    > [1] 
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftranspiledactionscript.com%2Fdev%2Fexamples%2F&data=02%7C01%7Caharui%40adobe.com%7Ce2e3e44ca87a4d025c6208d5af42afdd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636607623322568889&sdata=9vrin7DQVxaTK94dnfZkTpL8s4LIbB7fte8E%2BkjHJKI%3D&reserved=0
    > TranspiledActionScript/
    >
    > Thanks,
    > Piotr
    >
    > 2018-04-29 11:25 GMT+02:00 Piotr Zarzycki <piotrzarzyck...@gmail.com>:
    >
    >> Hi Alex,
    >>
    >> Ok I will look into that.
    >>
    >> Thanks,
    >> Piotr
    >>
    >>
    >> On Sun, Apr 29, 2018, 8:12 AM Alex Harui <aha...@adobe.com.invalid>
    >> wrote:
    >>
    >>> Hi Piotr,
    >>>
    >>> For me, parent is not undefined when the new value of snippetBackground
    >>> is being applied.  The first time I debugged through the code it looked
    >>> like was undefined, but when I stepped through the parent getter it
    >>> returned a valid result.  I'm not sure if we can trust the value 
tooltips
    >>> for our getters.
    >>>
    >>> I think the problem is that I did not upgrade the className
    >>> implementation in MDL when I updated UIBase and the Jewel code.  MDL is
    >>> still using the ClassList class and it should probably do what Jewel is
    >>> doing and use ClassSelectorList instead.   I think if that works for MDL
    >>> then we can drop ClassList from the code base.
    >>>
    >>> I would like you to do the upgrade since it will be easier for you to
    >>> test it and make any further adjustments.
    >>>
    >>> Thanks,
    >>> -Alex
    >>>
    >>> On 4/28/18, 10:02 PM, "Alex Harui" <aha...@adobe.com.INVALID> wrote:
    >>>
    >>>     I will look into it.
    >>>
    >>>     On 4/28/18, 2:08 PM, "Carlos Rovira" <carlosrov...@apache.org>
    >>> wrote:
    >>>
    >>>         Sorry but as I said I'm few days off so I can't look at it. Hope
    >>> you can
    >>>         see the root of the problem since I was planning to use states
    >>> in jewel
    >>>         example to do better organization of different examples
    >>>
    >>>
    >>>         El El sáb, 28 abr 2018 a las 9:58, Piotr Zarzycki <
    >>> piotrzarzyck...@gmail.com>
    >>>         escribió:
    >>>
    >>>         > Carlos,
    >>>         >
    >>>         > Any thoughts ? Maybe it make sense that parent is undefined
    >>> since view is
    >>>         > changing state - it's not added yet to the parent. We should
    >>> sort it out,
    >>>         > because I don't see any weird in my case. I'm just changing
    >>> className
    >>>         > dynamically. :)
    >>>         >
    >>>         > Thanks, Piotr
    >>>         >
    >>>         > 2018-04-28 9:54 GMT+02:00 piotrz <pio...@apache.org>:
    >>>         >
    >>>         > > DataBinding example is working fine, so it leads me to the
    >>> className
    >>>         > > property
    >>>         > > in UIBase. I have setup break point and it looks like
    >>> because this.parent
    >>>         > > is
    >>>         > > undefined className is not setup properly.
    >>>         > >
    >>>         > > Look into the screenshot. You can also setup breakpoint
    >>> yourself to see
    >>>         > > results.
    >>>         > >
    >>>         > > <https://na01.safelinks.protection.outlook.com/?url=http%3A%
    >>> 2F%2Fapache-royale-development.20373.n8.nabble&data=02%7C01%
    >>> 7Caharui%40adobe.com%7Ceea3fd5a126e40aa7bc108d5ad4c3ba8%7Cfa
    >>> 7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636605465381823797&
    >>> sdata=xdPoaM1ogtS7DFJsUOUEtPIq%2BpSYKYKcLNNrqjC3yKs%3D&reserved=0.
    >>>         > > com/file/t1/parent_undefined.png>
    >>>         > >
    >>>         > > Why it is even checked ? It was part of latest changes ?
    >>>         > >
    >>>         > > Thanks,
    >>>         > > Piotr
    >>>         > >
    >>>         > >
    >>>         > >
    >>>         > > --
    >>>         > > Sent from: 
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fna01.safelinks.protect&data=02%7C01%7Caharui%40adobe.com%7Ce2e3e44ca87a4d025c6208d5af42afdd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636607623322568889&sdata=1rkdnaRxxnGWPpZ2XNVf4QxA11JPDyVVzIj0Cu3LXPU%3D&reserved=0
    >>> ion.outlook.com/?url=http%3A%2F%2Fapache-royale-development
    >>> .20373.n8.nabble.com%2F&data=02%7C01%7Caharui%40adobe.com%7
    >>> Ceea3fd5a126e40aa7bc108d5ad4c3ba8%7Cfa7b1b5a7b34438794aed2c1
    >>> 78decee1%7C0%7C0%7C636605465381823797&sdata=G4tLoCptxaRSh%2B
    >>> PZfCMahadW3RCiHPTH918xG5%2FO3Q0%3D&reserved=0
    >>>         > >
    >>>         >
    >>>         >
    >>>         >
    >>>         > --
    >>>         >
    >>>         > Piotr Zarzycki
    >>>         >
    >>>         > Patreon: 
*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fna01.safelinks.protec&data=02%7C01%7Caharui%40adobe.com%7Ce2e3e44ca87a4d025c6208d5af42afdd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636607623322568889&sdata=b2MeJR7Kj2FiDzZBoy02d0ZPyVYgXBWCXdmt3cRKaZs%3D&reserved=0
    >>> tion.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiot
    >>> rzarzycki&data=02%7C01%7Caharui%40adobe.com%7Ceea3fd5a126e40
    >>> aa7bc108d5ad4c3ba8%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%
    >>> 7C0%7C636605465381823797&sdata=Sk%2BnEHPqRyaQ7vYVSeTnif
    >>> 0tactznUV1PxtqHn8kobg%3D&reserved=0
    >>>         > <https://na01.safelinks.protection.outlook.com/?url=https%
    >>> 3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&data=02%7C01%7Caharu
    >>> i%40adobe.com%7Ceea3fd5a126e40aa7bc108d5ad4c3ba8%7Cfa7b1b5a7
    >>> b34438794aed2c178decee1%7C0%7C0%7C636605465381823797&
    >>> sdata=Sk%2BnEHPqRyaQ7vYVSeTnif0tactznUV1PxtqHn8kobg%3D&reserved=0>*
    >>>         >
    >>>         --
    >>>         Carlos Rovira
    >>>         https://na01.safelinks.protection.outlook.com/?url=http%3A%
    >>> 2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.
    >>> com%7Ceea3fd5a126e40aa7bc108d5ad4c3ba8%7Cfa7b1b5a7b34438794a
    >>> ed2c178decee1%7C0%7C0%7C636605465381823797&sdata=LZQiGYiUknr
    >>> mz7QOfTTLJheSdn3cm3XceN95hVidJv4%3D&reserved=0
    >>>
    >>>
    >>>
    >>>
    >>>
    >
    >
    > --
    >
    > Piotr Zarzycki
    >
    > Patreon: 
*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&data=02%7C01%7Caharui%40adobe.com%7Ce2e3e44ca87a4d025c6208d5af42afdd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636607623322568889&sdata=t9nneCguO%2BFqQA8UcLcW4kFdWBWAJR1Gz9Wffsz6r%2F0%3D&reserved=0
    > 
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&data=02%7C01%7Caharui%40adobe.com%7Ce2e3e44ca87a4d025c6208d5af42afdd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636607623322568889&sdata=t9nneCguO%2BFqQA8UcLcW4kFdWBWAJR1Gz9Wffsz6r%2F0%3D&reserved=0>*
    >
    
    
    
    -- 
    
    Piotr Zarzycki
    
    Patreon: 
*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&data=02%7C01%7Caharui%40adobe.com%7Ce2e3e44ca87a4d025c6208d5af42afdd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636607623322568889&sdata=t9nneCguO%2BFqQA8UcLcW4kFdWBWAJR1Gz9Wffsz6r%2F0%3D&reserved=0
    
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&data=02%7C01%7Caharui%40adobe.com%7Ce2e3e44ca87a4d025c6208d5af42afdd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636607623322568889&sdata=t9nneCguO%2BFqQA8UcLcW4kFdWBWAJR1Gz9Wffsz6r%2F0%3D&reserved=0>*
    

Reply via email to