[Seaside-dev] WATagBrush>>class:if: with boolean and additional blocks

Philippe Marschall philippe.marschall at gmail.com
Mon Dec 30 19:20:12 UTC 2013


On Mon, Dec 30, 2013 at 12:31 PM, Torsten Bergmann <astares at gmx.de> wrote:
> WATagBrush>>class:if: is implemented like this:
>
>
>     class: aString if: aBoolean
>         "Adds the class aString to the receiving element if aBoolean is true.
>
>         Example:
>
>         html div
>                 class: 'error' if: self hasError;
>                 with: self errorMessage"
>
>         aBoolean
>                 ifTrue: [ self class: aString ]


What's the use case for this?

Instead of

html tag
  class: 'class-name'
  if: (receiver selector)

you can now have:

html tag
  class: 'class-name'
  if: [ receiver selector ]

What am I missing?

> What about changing it to:
>
>     class: aString if: aBooleanOrBlock
>         ...
>
>         aBooleanOrBlock value
>                 ifTrue: [ self class: aString ]
>
>
> This way one could use a boolean as before but also a conditional block coming from
> elsewhere. This change would also be backward compatible and not break existing code.
>
> What do you think?

Ce n'est pas si facile [1]:
 * Do not assume #value is part of the Object protocol

 [1] http://code.google.com/p/seaside/wiki/CodingConventions

Cheers
Philippe


More information about the seaside-dev mailing list