[Html-widget] attributes
A. Pagaltzis
pagaltzis at gmx.de
Fri Sep 22 15:29:24 CEST 2006
* Carl Franks <fireartist at gmail.com> [2006-09-22 14:50]:
> Setting attributes in this way overwrites on the current
> attributes hash, and wipes out the 'size' which internally is
> saved as an attribute. Not good.
So save `size` beforehand and wedge it back in after assigning
the new hash.
> I suggest we allow an attributes hash-ref to be passed as the
> last argument to HTML::Widget->new() and $w->elements()
Sounds good to me.
> If multiple values are passed to attributes(), rather than a
> hash-ref, add them to the current attributes hash.
That’s what I would propose. I find the behaviour of `attributes`
surprising and very inconvenient anyway.
I can’t imagine many cases where I want to replace all attributes
whereas I want to add a single attribute to a tag *all the time*.
Both things are doable manually: you can fetch the hash and then
either set particular (sets of) keys on it or clear it; hence the
method should provide a shortcut to the common operation, rather
than to the rare one.
> However, I think
> attributes( disabled => 'disabled' );
> is too close, visually, to
> attributes( { disabled => 'disabled' } );
The best option would probably be a new method. The only problem
is that the obvious name is taken so any new names will be poorly
Huffmanized…
> Add AUTOLOAD to HTML::Widget::Accessor, and make sure
> HTML::Widget::Accessor is always last in the inheritance chain.
Noooooooooooooo… no! No magic, pretty pretty please.
Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>
More information about the Html-widget
mailing list