Side navigation
#6846 closed bug (worksforme)
Opened July 28, 2010 10:37PM UTC
Closed July 29, 2010 01:17AM UTC
Last modified March 15, 2012 01:48PM UTC
Cannot select tags with ids containing periods
| Reported by: | gwatts | Owned by: | |
|---|---|---|---|
| Priority: | Milestone: | 1.4.3 | |
| Component: | selector | Version: | 1.4.2 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
$('#some.id') will not match a tag with an id of "some.id" even though it's valid HTML according to http://www.w3.org/TR/html4/types.html#type-name
Updating quickExpr on line 38 of jquery-1.4.2.js to add the period to the regex fixes it for me:
quickExpr = /^[^<]*(<[\\w\\W]+>)[^>]*$|^#([\\w.-]+)$/
I guess to agree with the spec it should also include colons and underscores.
Attachments (1)
Change History (1)
Changed July 29, 2010 01:17AM UTC by comment:1
| resolution: | → worksforme |
|---|---|
| status: | new → closed |
$("#some.id")Matches an id of "some" with a class of "id", just as it does with CSS selectors. If you want to make your life hard and use ids with dots, you'll need to escape it with a backslash. Since Javascript uses backslash as an escape as well, you have to use two backslashes in the string.$("#some\\\\.id")The best place to ask questions like this is on the forum:
http://forum.jquery.com