Bug Tracker

Modify

Ticket #7712 (closed bug: duplicate)

Opened 2 years ago

Last modified 2 years ago

.attr / child element mixup

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

Description (last modified by jitter) (diff)

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

comment:1 Changed 2 years ago by daniel@…

Improved markup:  http://jsfiddle.net/mVaPj/

comment:2 Changed 2 years ago by jitter

  • Description modified (diff)

comment:3 follow-up: ↓ 4 Changed 2 years ago by rwaldron

  • Owner set to daniel@…
  • Status changed from new to pending

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

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

Last edited 2 years ago by rwaldron (previous) (diff)

comment:4 in reply to: ↑ 3 Changed 2 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 2 years ago by jitter

  • Status changed from pending to closed
  • Resolution set to duplicate

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 2 years ago by jitter

Duplicate of #3685.

comment:7 Changed 2 years ago by jitter

  • Priority changed from undecided to high
  • Component changed from unfiled to manipulation

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.