Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#7712 closed bug (duplicate)

.attr / child element mixup

Reported by: daniel@… Owned by: daniel@…
Priority: high Milestone: 1.6
Component: manipulation Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by jitter)

$('#myform').attr('action', 'http://google.com') fails if the form has a hidden element named action. Example markup:

<form action="http://bing.com" method="post" id="myform">
    <input type="hidden" name="action" value="something" />
</form>

I'll post a testcase as soon as I have time.

Change History (7)

comment:1 Changed 8 years ago by daniel@…

comment:2 Changed 8 years ago by jitter

Description: modified (diff)

comment:3 Changed 8 years ago by Rick Waldron

Owner: set to daniel@…
Status: newpending

Is it broken in a specific browser? This works for me:

http://jsfiddle.net/rwaldron/mVaPj/1/

Last edited 8 years ago by Rick Waldron (previous) (diff)

comment:4 in reply to:  3 Changed 8 years ago by jitter

Replying to rwaldron:

Is it broken in a specific browser? This works for me: http://jsfiddle.net/rwaldron/mVaPj/1/

broken e.g. in FF 3.6.12, IE6 (throws exception)

But this is something that should get fixed with the .attr() rewrite for 1.5

comment:5 Changed 8 years ago by jitter

Resolution: duplicate
Status: pendingclosed

This is a well known problem (References)
Deadly Expandos
Unsafe Names for HTML Form Controls

The problem comes from the old DOM 0/DOM 1 days. DOM 1 HTML states

The FORM element encompasses behavior similar to a collection and an element. It provides direct access to the contained input elements as well as the attributes of the form element.

As noted in my comment above this should all go away with the upcoming .attr() rewrite.

comment:6 Changed 8 years ago by jitter

Duplicate of #3685.

comment:7 Changed 8 years ago by jitter

Component: unfiledmanipulation
Priority: undecidedhigh
Note: See TracTickets for help on using tickets.