metaTagNamed: (Was Re: [Seaside] inHeadDo:)

Avi Bryant avi at beta4.com
Fri Jun 13 10:54:48 CEST 2003


On Thu, 12 Jun 2003, Nevin Pratt wrote:

> OK, easy enough.  the attributes: argument is now a dictionary (or
> rather, a subclass of Dictionary) rather than an array of associations.
>
> Not that it particularly matters, but why was this change made?  In
> fact, precisely *because* it doesn't look like it particularly matters,
> why was the change made?  There must be a reason that I'm not seeing.

Well, it's not actually a subclass of Dictionary.  It's WAHtmlAttributes,
which keeps an OrderedCollection of associations, but does present a
dictionary-like interface (#at:put:).

You stumbled upon this when building a WAHtmlElement from scratch.  The
change wasn't made with this case in mind (the only time you need to do
this is when adding a head element), but so that
WAHtmlRenderer>>attributes: could be deprecated in favor of
WAHtmlRenderer>>attributes.  That is, where you used to write

html attributes: {'width' -> 23. 'height' -> 42}.

I would now recommend using

html attributes width: 23; height: 42.

This required introducing an HtmlAttributes class that responds to
#width:, #height:, #valign:, etc.  Currently it does this with DNU,
although in the long run it should probably just have all the valid
attributes as methods.

There were two reasons for this change.  One is that it allows for more
abstraction at the attribute level - for example, you could add verbose
aliases such as #verticalAlignment: if you were so inclined, or better yet
#alignTop, #alignMiddle, #alignBottom.

The other is that it reduces the use of the non-portable {} syntax; this
was an issue for the VW port.

Hope that answers your question.

Cheers,
Avi



More information about the Seaside mailing list