#7712 closed bug (duplicate)
.attr / child element mixup
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | 1.6 |
Component: | manipulation | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description (last modified by )
$('#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 12 years ago by
comment:2 Changed 12 years ago by
Description: | modified (diff) |
---|
comment:3 follow-up: 4 Changed 12 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
Is it broken in a specific browser? This works for me:
comment:4 Changed 12 years ago by
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 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | pending → closed |
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:7 Changed 12 years ago by
Component: | unfiled → manipulation |
---|---|
Priority: | undecided → high |
Improved markup: http://jsfiddle.net/mVaPj/