Bug Tracker

Opened 14 years ago

Closed 14 years ago

#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
Blocked by: Blocking:


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 (1)

lower_unicode_characters.diff (1.5 KB) - added by choan 14 years ago.
Patch to support #áéíóú selectors

Download all attachments as: .zip

Change History (4)

Changed 14 years ago by choan

Patch to support #áéíóú selectors

comment:1 Changed 14 years ago by flesler

Cc: choan added
Owner: set to flesler
Status: newassigned

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 14 years ago by choan


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 14 years ago by john

Resolution: fixed
Status: assignedclosed

That's an easy fix, just landed it in Sizzle, will push to jQuery soon. http://github.com/jeresig/sizzle/commit/70d75cdf79778f3a34a0bd601faa13e71c673e2d

Note: See TracTickets for help on using tickets.