Ticket #3630 (closed bug: fixed)
Selectors don't support low Unicode characters (eñe)
| Reported by: | choan | Owned by: | flesler |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.3 |
| Component: | selector | Version: | 1.2.6 |
| Keywords: | Cc: | choan | |
| Blocking: | Blocked by: |
Description
Unicode support in selectors is flawed and does not allow usage of certain unicode characters (Spanish accented letters, or eñe for example).
Patch provided.
Not sure if the new range (starting from \u00c0) is the most appropiate.
Attachments
Change History
Changed 4 years ago by choan
-
attachment
lower_unicode_characters.diff
added
comment:1 Changed 4 years ago by flesler
- Cc choan added
- Owner set to flesler
- Status changed from new to assigned
Patch to support #áéíóú selectors
Does this support eñe as well ?
Question is, are they really valid characters to be used on id's, class, etc ?
I googled that (very quickly) and couldn't find the answer.
comment:2 Changed 4 years ago by choan
Ariel:
There are differences between HTML and XHTML (or XML) for this case.
Class attributes are CDATA in both cases. Any character is allowed. See http://www.w3.org/TR/REC-html40/types.html#type-cdata
Id attributes are defined as type ID in HTML and the character set is restricted. See http://www.w3.org/TR/REC-html40/types.html#type-id
But in XML (XHTML) are defined as names, and most of the restrictions don't apply: http://www.w3.org/TR/REC-xml/#NT-Name
About the patch, yes, it will accept "eñes". This is the proposed change:
- "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)", + "(?:[\\w\u00c0-\uFFFF*_-]|\\\\.)",
Check the ranges [\u0128-\uffff] and [\u00c0-\uffff] at http://hamstersoup.com/javascript/regexp_character_class_tester.html
comment:3 Changed 4 years ago by john
- Status changed from assigned to closed
- Resolution set to fixed
That's an easy fix, just landed it in Sizzle, will push to jQuery soon. http://github.com/jeresig/sizzle/commit/70d75cdf79778f3a34a0bd601faa13e71c673e2d
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Patch to support #áéíóú selectors