Ticket #4299 (closed bug: duplicate)
attr(attrName, newAttrValue) fails on object which has child with name=attrName
| Reported by: | soswow | Owned by: | flesler |
|---|---|---|---|
| Priority: | major | Milestone: | 1.4 |
| Component: | core | Version: | 1.4a1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Sorry, if dublicate, but its strange, that this is not fixed since old versions.
Bug is: When I have form with some inputs with name=action for example, I cant change "action" attribute of this form with "attr" method! As I finded out I cant change any attribute of form when there is same named control inside form.
I don't know what about other attributes of other element if there is control with same name inside it.
This bug applyes only to FF (3 at least) and IE (6 and 7 tested) Safary and Chrome works well.
IE even throw exception in described situation.
A attaching HTML with working example of the bug. You can test it various browsers and You will get different results.
Attachments
Change History
Changed 4 years ago by soswow
-
attachment
jQueryBug.html
added
Changed 4 years ago by soswow
-
attachment
jQueryBug.2.html
added
Same example with success native DOM working.
comment:2 Changed 3 years ago by petersendidit
Because you can access form fields via form[fieldName], when the code tried to set the attribute via form[name]=value, it wouldn't work. This was correctly handled when getting form attributes but wasn't handled correctly in setting.
http://github.com/petersendidit/jquery/commit/112eb9c1aa7277c108158d504c6c0ef0f06dbcb8
comment:3 Changed 3 years ago by john
- Status changed from new to closed
- Version changed from 1.3.2 to 1.4a1
- Resolution set to fixed
comment:4 Changed 3 years ago by john
- Status changed from closed to reopened
- Resolution fixed deleted
The problem wasn't actually solved, still fails in IE, I backed out the commit.
http://github.com/jquery/jquery/commit/27d65b59f96460987abb84dadc3a75dde8826b3a
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Example to Bug #4299