Hi,

The main problem I see with this is that we cannot cover all possible names.
1) It is possible to create custom HTML elements in JavaScript. So the list
of names should be easy to extend
2) with Web Components standard custom names are used even more often
3) and yes, some users use Wicket to generate XML/SVG/... where case
sensitivity is important

I remember some users wanted to have a list of JS events. The main problem
with this before that we had to have both "click" and "onclick" before 6.0.
Now we don't need the onXYZ version. But again it should be easy to extend
because using custom JS event names is also very common in development.

Are there that many occurrences of such hardcoded HTML element and event
names ? I don't remember having any problems with them for the last 4 years.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Sat, Jul 12, 2014 at 11:53 PM, Garret Wilson <gar...@globalmentor.com>
wrote:

> Hi, all. I notice that throughout the code HTML element and attribute
> names are hard-coded. Does Wicket have a list of HTML name and attribute
> constants that we could reference? I would find that a lot safer, and
> perhaps even more readable. Not only that, it would allow us to quickly
> find all the places that use the e.g. HTML.Element.EM element.
>
> Secondly, in the same vein, I see lots of code like this:
>
> if(tag.getName().equalsIgnoreCase("a"))...
>
> That's also tedious and error-prone---I can't trust myself not to forget
> to do a case-insensitive comparison. Perhaps there could be a
> ComponentTag.hasName() method that does this for me? So the above would be:
>
> if(tag.hasName(HTML.Element.EM))...
>
> On the other hand, perhaps Wicket is wanting to support other contexts
> such as general XML, in which case case-sensitive matching is necessary. (I
> would imagine that the entire codebase plays loosely with whether or not
> matching is case-sensitive, though. More research is necessary on my part.)
>
> What do you think at least about having HTML element/attribute constants?
> That my be an area I can contribute to in the short term.
>
> Garret
>

Reply via email to