On May 27, 6:21 am, MorningZ <morni...@gmail.com> wrote:
> So if you had:
>
> <input type="text" id="user.name" />
>
> how would you apply a style to that?

Using a class or a selector other than the id.

>
> can't say:
>
> #user.name {
> }
>
> because that would look for
>
> <input type="text" id="user" class="name" />
>
> yeah, "poor choice" sure is relative, but why make things more
> difficult, when a simple dash or underscore would do the same thing
> (and not cause issues with basic CSS or jQuery)

The choice is clear - the OP can simply stop using jQuery selectors
for those elements, or stop using jQuery (or any other CSS selector-
based framework) at all.  Given that it's an ID, the OP could use:

  $(document.getElementById('user.name'))...

Which is likely faster anyway.

There is conflict between what is allowed as a value of the ID
attribute and what CSS can use to select elements by ID.  It remains
an issue for anyone wishing to select elements using CSS selectors,
regardless of the context.

It is also an issue with the W3C Selectors API, a specification to
which John Resig (and many others) contributed, yet there is nothing
within that specification to address the issue raised in this thread.
Clearly they don't think it's worth addressing.  The jQuery
documentation does, after all, refer to them as "weird" and "special"
characters.


--
Rob

Reply via email to