These are chat archives for canjs/canjs

3rd
Mar 2016
Guido Smeets
@gsmeets
Mar 03 2016 13:23
I have a dialog that pops up and some container within that dialog will need to have a js-calculated max-height, because that's where the scrollbar needs to appear.
Is there some way to listen to dom changes within a component?
not sure if that child element will exist in all cases from the get go
Julian
@pYr0x
Mar 03 2016 13:23
the event object`?
Guido Smeets
@gsmeets
Mar 03 2016 13:26
can I do something like:
".scroll-panel inserted" : function() { }
does that work?
will give that a go
Julian
@pYr0x
Mar 03 2016 13:27
i think inserted only works for the current component
but you can trigger a custom event if .scroll-panel will inserted and listen on the other components event
Guido Smeets
@gsmeets
Mar 03 2016 13:30
heh, yeah good point
unfortunately scroll-panel is a div at the moment ;)
but I was considering making that a component too
Curtis Cummings
@ccummings
Mar 03 2016 14:16

inserted will fire on any element but you can’t use events to listen to it because inserted events don’t bubble.

So you could bind to scroll-panel inserted in your Components inserted event

Guido Smeets
@gsmeets
Mar 03 2016 14:18
that child might not exist at parent insert, that's the problem
there could be some deferred ajax call that's holding back rendering of some subcomponent down the dom tree
I'll go with changing my scroll panel to a component and firing a custom event on its insert in the future
for now I'll suffice with a setTimeout workaround in my parent component's inserted event
thanks for thinking along ;)