Opened 14 years ago
Closed 14 years ago
#3741 closed bug (fixed)
Name selector with a context should fallback when context doesn't support getElementsByName [jQuery 1.3 Beta 1]
Reported by: | chuyeow | Owned by: | john |
---|---|---|---|
Priority: | major | Milestone: | 1.3 |
Component: | selector | Version: | 1.2.6 |
Keywords: | sizzle | Cc: | chuyeow |
Blocked by: | Blocking: |
Description
I ran into this bug while testing jQuery 1.3b1:
$('input[name=foo', '#form'); => Throws a context.getElementsByName is not a function error.
Turns out Sizzle will call getElementsByName
even when there is a context argument passed to the selector, and this breaks when the context doesn't support getElementsByName
. AFAIK this only works on document
(i.e. no context).
I also found while fixing this bug that input[name="foo"]
will NOT use the NAME selector (it falls back to the TAG-based selector).
I've a couple of patches to Sizzle that fixes these 2 bugs with tests over at my Github fork: http://github.com/chuyeow/sizzle/commits/context_selector_fixes (commits 19d4277 and be83e65).
I'll be generating a plain old patchfile as well in case that's more convenient :)
Attachments (2)
Change History (4)
Changed 14 years ago by
Attachment: | 0002-Allow-name-selectors-with-quotes-e.g.-input-name.patch added |
---|
Changed 14 years ago by
Attachment: | 0003-Call-getElementsByName-conditionally-in-NAME-selecto.patch added |
---|
Call getElementsByName conditionally in NAME selector
comment:1 Changed 14 years ago by
Cc: | chuyeow added |
---|---|
Component: | unfilled → selector |
Owner: | changed from flesler to john |
comment:2 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Version: | → 1.2.6 |
This has been landed in Sizzle and will be merged into jQuery core very soon.
Allow input[name="foo"] (note the quotes) to use the name-based selector