Side navigation
#3803 closed bug (fixed)
Opened January 07, 2009 12:39PM UTC
Closed January 11, 2009 02:11PM UTC
if the ID of an element contains a dot ("."), it's ancestores are not selectable by tag
Reported by: | ghum | Owned by: | john |
---|---|---|---|
Priority: | major | Milestone: | 1.3 |
Component: | selector | Version: | 1.2.6 |
Keywords: | regression escaped dot id ancestors | Cc: | |
Blocked by: | Blocking: |
Description
regression:
within 1.2.6
$("#i7922\\\\.dxa input")
selects all input-elements below the element with the ID i7922.dxa
within 1.3.beta1
$("#i7922\\\\.dxa input")
does not select any input element below the element with "i7922.dxa"
For elements WITHOUT an escaped "." all is still fine.
The attached sample demonstrates the problem
Attachments (1)
Change History (3)
Changed January 09, 2009 04:39PM UTC by comment:1
Changed January 10, 2009 09:27AM UTC by comment:2
I've just had a look at http://github.com/jeresig/sizzle/commit/88edec547d5f5e0979c86a0ab5e872adcb0f2a7a
and the modified class preFilter: so because IDs can't contain a backslash and I forgot the global modifier this would work better:
jQuery.expr.preFilter.ID = function(match){ return match[1].replace(/\\\\/g,""); }
Though I'm not sure if classes can contain a backslash or not:
Changed January 11, 2009 02:11PM UTC by comment:3
resolution: | → fixed |
---|---|
status: | new → closed |
version: | → 1.2.6 |
Yeah, they were already being removed from the class filters but not ID, should be fixed now:
http://github.com/jeresig/sizzle/commit/6bb75a1f136d30fa5d8486f5aa1fc7e5ed08d9b2
The problem is that preFilter.ID simply returns
match[1]
, which still contains an unnecessary backslash so it won't match the item's id afterwards. Removing these backslashes in preFilter solves it: