As far as I can see, the only reasons not to lower-case stuff automatically are that it's too magic and/or too expensive to check all the attribute modifiers.

I can also foresee someone wanting to use upper-case and then running an XSLT transform over it or something, and complaining that we've broken their use-case.

I'd be in favour of a runtime check in both DEVELOPMENT and DEPLOYMENT that AttributeModifiers are lowercase, perhaps with a setAllowUppercase(true) to cover the uncommon case if anyone needs it?

You can go if (foo.toLowerCase() == foo) which is reasonably cheap (most attributes are less than ~10 chars, so it's just 10 or so comparison operations, no new String will be made if it's already correct.

As a slight aside, but related to the magic, I've long been confused by AttributeModifier silently throwing things away if you omit the boolean constructor param. It seems to confuse fresh Wicket developers. Does anyone have a use-case for this? Why is it like that?

Al

--
Alastair Maw
Wicket-biased blog at http://herebebeasties.com

Reply via email to