#9594 closed bug (duplicate)
attr selectors in find, find nothing
Reported by: | funkjunky8 | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | selector | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jQuery 1.6 Chrome 11 Mac OS X Snow Leopard JSFiddle: http://jsfiddle.net/ScN4a/
alert(newKeyValueRow.find('input[name*="from"]').length);
alert(newKeyValueRow.find('input[name~="from"]').length); alert(newKeyValueRow.find('input[name|="bucket_from"]').length); alert(newKeyValueRow.find('input[name]').eq(1).attr("name"))
These output: 1 0 0 bucket_from[0][]
The html is as follows (taken from the developer tools of chrome): <tr class="bucketRow"> <td> <input type="text" name="bucket_to[0]" value=""></td> <td class="bucketValueTD"><= <input type="text" name="bucket_from[0][]" value=""> <input type="button" class="bucket_add_row" value="add value"> </td> </tr>
JSFiddle: http://jsfiddle.net/ScN4a/ (note: I put the alerts into a click of the button.)
As far as I understand, the first two alerts ABSOLUTELY should show the same thing. The third one should as well, but it is a little less obvious, although still fairly obvious.
Change History (5)
comment:1 Changed 12 years ago by
Component: | unfiled → selector |
---|---|
Priority: | undecided → high |
Resolution: | → duplicate |
Status: | new → closed |
comment:2 Changed 12 years ago by
comment:3 Changed 12 years ago by
If you insist. The bug referenced appears to refer to the attribute existing, while my bug expands the issue to matching attributes using specific selectors.
comment:4 Changed 12 years ago by
Priority: | high → low |
---|
You're right, it's not a dup, I think it's invalid.
~=
is the "contains word" selector; input[name~="from"]
shouldn't match anything because there is no *space-delimited* string from
in the markup. http://api.jquery.com/attribute-contains-word-selector/
|=
is the "contains prefix" selector; input[name|="bucket_from"]
shouldn't match anything because there is no name that is either exclusively that string or prefix that string *followed by a dash*. http://api.jquery.com/attribute-contains-prefix-selector/
It's best to start on the forum with questions like this and only file a bug once you've got some consensus that it's really a bug.
comment:5 Changed 12 years ago by
I see now. I misunderstood the use of those 2 functions. Next time I will query the forum before submitting a bug.
Sorry about the false report, and thanks for the reply.
Duplicate of #9261.