Skip to main content

Bug Tracker

Side navigation

#4299 closed bug (duplicate)

Opened March 05, 2009 11:45AM UTC

Closed November 22, 2010 05:13AM UTC

Last modified November 22, 2010 05:13AM UTC

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:
Blocked by: Blocking:
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 (2)
  • jQueryBug.2.html (2.2 KB) - added by soswow March 05, 2009 11:56AM UTC.

    Same example with success native DOM working.

  • jQueryBug.html (1.7 KB) - added by soswow March 05, 2009 11:45AM UTC.

    Example to Bug #4299

Change History (7)

Changed September 14, 2009 07:11PM UTC by flesler comment:1

owner: → flesler

Changed December 07, 2009 11:52PM UTC by petersendidit comment:2

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

Changed December 09, 2009 06:45AM UTC by john comment:3

resolution: → fixed
status: newclosed
version: 1.3.21.4a1

Changed December 18, 2009 04:30PM UTC by john comment:4

resolution: fixed
status: closedreopened

The problem wasn't actually solved, still fails in IE, I backed out the commit.

http://github.com/jquery/jquery/commit/27d65b59f96460987abb84dadc3a75dde8826b3a

Changed August 18, 2010 07:28PM UTC by masklinn comment:5

Isn't this bug a duplicate of #3113 (or the other way around, this one is slightly more general, there's also #1169)?

Also, why comment out the failing test, rather than leave it as a todo mark?

Changed November 22, 2010 05:13AM UTC by snover comment:6

resolution: → duplicate
status: reopenedclosed

We are rewriting .attr in 1.5 and hopefully can get this dealt with then.

Changed November 22, 2010 05:13AM UTC by snover comment:7

Duplicate of #7472.