Carsten Ziegeler wrote:
Sylvain Wallez wrote:
So please choose one proposal below:
[ ] "foo.bar:input" (colon, not CSS-friendly because of IE)
[ ] "foo.bar..input" (double period)
[ ] "foo.bar.input." (trailing period)
[ ] "foo.bar._input" (underscore, requires to forbid it as the beginning
of widget names)
Sorry for stepping in very late, but to me all of these solutions look
rather ugly. If I only have the choice between the four from above, I
would go for the underscore solution.
But why can't we just use "bar-input" and forbid to use id's that end
with "-input"? Or forbid the use of '-'?
Oh please, go read the threads.
We cannot forbid "-" in widget names, as it's used in too much
occasions. And the problem is not only "-input" but also "-cal",
"-help", "-toolbar", "-combobox", "-resize-handle" or "-whatever" will
come out from advanced stylings.
So we need a *general* rule for all generated IDs that ensures no one
will ever conflict with widget names. We then structurally avoid and
problem in the future, whatever mapping people invent between a widget
and its HTML rendering.
Also, if you read the thread, you will notice that this notation is
almost transparent to _user_ (not styling writers) as the use of these
generated IDs will mostly be restricted to plug additional behaviour to
inputs and in that case they can use form.inputs['foo.bar'] which is
totally independent from the naming rule used.
The other case where these IDs may be used is for CSS rules, but I
consider that this will be very unfrequent as most often, CSS class
selectors will be used to style a whole family of widgets rather than
individual ones, for which they can use a specific class anyway. And
even for an individual widget, it's IMO better to define an additional
CSS class rather than using the full ID, as it decouples class rules
from widget names.
My initial proposal, using ':' was IMO the cleanest, but some issues
were raised with the way this character has to be escaped in CSS rules
with IE. Even if, again, I think CSS class selectors will be used much
more often than CSS ID selectors.
Sylvain
--
Sylvain Wallez Anyware Technologies
http://people.apache.org/~sylvain http://www.anyware-tech.com
Apache Software Foundation Member Research & Technology Director