Skip to main content

Bug Tracker

Side navigation

#7712 closed bug (duplicate)

Opened December 06, 2010 01:39PM UTC

Closed December 06, 2010 03:52PM UTC

Last modified December 06, 2010 03:53PM UTC

.attr / child element mixup

Reported by: daniel@danwebs.dk Owned by: daniel@danwebs.dk
Priority: high Milestone: 1.6
Component: manipulation Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:
Description

$('#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.

Attachments (0)
Change History (7)

Changed December 06, 2010 01:42PM UTC by daniel@danwebs.dk comment:1

Improved markup:

http://jsfiddle.net/mVaPj/

Changed December 06, 2010 02:36PM UTC by jitter comment:2

description: $('#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.`$('#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.

Changed December 06, 2010 03:24PM UTC by rwaldron comment:3

_comment0: Is it broken in a specific browser? Because this works for me: \ \ \ http://jsfiddle.net/rwaldron/mVaPj/1/1291649072827169
owner: → daniel@danwebs.dk
status: newpending

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

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

Changed December 06, 2010 03:35PM UTC by jitter comment:4

Replying to [comment:3 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

Changed December 06, 2010 03:52PM UTC by jitter comment:5

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.

Changed December 06, 2010 03:52PM UTC by jitter comment:6

Duplicate of #3685.

Changed December 06, 2010 03:53PM UTC by jitter comment:7

component: unfiledmanipulation
priority: undecidedhigh