Skip to main content

Bug Tracker

Side navigation

#3630 closed bug (fixed)

Opened November 21, 2008 02:42AM UTC

Closed January 11, 2009 01:10AM UTC

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:
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 (1)
Change History (3)

Changed November 25, 2008 11:50AM UTC by flesler comment:1

cc: → choan
owner: → 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.

Changed November 29, 2008 01:23PM UTC by choan comment:2

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

Changed January 11, 2009 01:10AM UTC by john comment:3

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