[Seaside] OK to directly call (#renderContentOn: html) of sub-component ?

Lukas Renggli renggli at gmail.com
Sat Jan 19 08:23:26 UTC 2008

No, not ok.

> I read some time ago that a parent component should not directly call
> #renderContentOn: on its children; instead it should do (html render:
> child).

Please, check the class-comment of WAComponent and the comment of

If you do it anyway, decorations (e.g. #call:/#answer:) and child
components won't work. Callbacks will be owned and be executed in the
context of your parent. It is considered bad practice and will result
in unforeseeable problems.

Have a look at the self-senders of #renderContentOn: to see what you
miss when you call it directly. Alternatively step though #render:
with the debugger.

> However, I've tried direct calls in a few places and it works OK; also makes
> my interfaces more uniform, as parent may wants to pass some options into
> the rendering of its child so often wants to use (child renderOn: html with:
> options).

What you want is something pretty common, but then you should not
subclass WAComponent. Depending on whether you need state there are
two possibilities:

- Without state: create a new brush.

- With state: create a new class (subclass of Object) and implement
#renderOn: accordingly. Don't declare this object as a child, it is
not a component, but store it in some instance-variable (i guess this
is what you need).


PS: Maybe you want to introduce yourself sometime? You ask a lot of
interesting questions and people are certainly interested to know who
you are and what you are doing ...

Lukas Renggli

More information about the seaside mailing list