tal
tal copied to clipboard
Carousel Widget Strips not returning widgets when appending/inserting
Hiya everyone from the TAL crew,
In the 'antie/widgets/carousel'
module you have the following methods;
-
appendChildWidget
-
insertChildWidget
Which normally, atleast if the widget you're trying to add is not already present, returns a widget. Just as in the 'antie/widgets/container'
module.
However for the Widget Strips (e.g. CullingStrip & WrappingStrip, which extend the 'antie/widgets/carousel/strips/widgetstrip'
module), this is not the case as the append
& insert
methods don't return the value of calling the method of its "parent" Widget.
We sometimes use the aforementioned methods to assign variables when appending widgets, e.g.;
var myCarouselItem = carousel.appendChildWidget(new Button());
So when I switched to using the CullingStrip (instead of the default WidgetStrip), my code was erroneous, as the variables were undefined
all of a sudden.
Are the append
& insert
methods of the Widget Strips not returning anything done intentionally or is this a bug?
Kind regards,
Sander Looijenga 24i
It does seem odd that they would have inconsistent APIs, especially given that the WidgetStrip.append
returns a Widget, and the two that extend this do not document an API change.
Further strangeness is that the JSDoc comment doesn't say that WidgetStrip.append
does return.
I believe appendChildWidget should be returning a widget for consistency with the other widgets defined in TAL, and therefore so should append
and insert
on the Strips.
Please let me know if it is a bug, then I can create a PR to fix it 👍
I believe it to be one, yes. A PR would be great, thanks 😄
We have deprecated this project and there are no plans for active development going forward.
Please see the deprecation notice.