Christof Donat schrieb:
> Hi,
> 
>> $('[EMAIL PROTECTED]"my:elem"]')
> 
> I guess, that that does not use getElementById() and thus is a lot slower 
> than 
> $('#my:elem'). I guess, that JSF might also have Problems with CSS, becaue 
> there you use stuff like #my:hover, etc.
> 
> To make the patch to jQuery as small as possible and let most existing code 
> continue to work: How about something like this: $('#my\:elem') selects the 
> Element with the ID "my:elem" whereas $('#my:elem') selects the Element with 
> the ID "my" and uses :elem as custom selector. That could be achieved by 
> simply changing the regular expression, Manfred named to 
> /^([#.]?)(([a-z0-9\\*_-]|\\:)*)/i
> 
> Christof

I didn't like the idea of hacking jQuery to make selectors with these 
special chars work, but as it turned out, that is what should be 
expected! From the CSS spec:

In CSS 2.1, a backslash (\) character indicates three types of 
character escapes.

[...]

*Second, it cancels the meaning of special CSS characters.* Any 
character (except a hexadecimal digit) can be escaped with a backslash 
to remove its special meaning. For example, "\"" is a string consisting 
of one double quote. Style sheet preprocessors must not remove these 
backslashes from a style sheet since that would change the style sheet's 
meaning.

http://www.w3.org/TR/CSS21/syndata.html#q6

Thus, I think a selector like "#my\:elem" is perfectly valid and that 
should be part of jQuery's selector engine...



-- Klaus


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to