Bug Tracker

Opened 10 years ago

Closed 10 years ago

#5644 closed bug (duplicate)

Form attributes mishandled by attr() when fields share names with attributes

Reported by: kenaniah Owned by:
Priority: critical Milestone: 1.4
Component: core Version: 1.3.2
Keywords: form, attr, attribute Cc:
Blocked by: Blocking:

Description

Consider the following form:

  <form id="frm" action="search.html" method="post">
    <input type="hidden" name="action" value="search" /> 
    <input name="term" value="" />
    <input type="submit" value="Search" />
  </form>

One would expect $("#frm").attr('action') to return search.html. Instead, the attribute look up fails. I believe this is because document.getElementById("frm").action returns the <input> element instead of the attribute node. jQuery should instead utilize the form.attributes nodemap to access form attributes, because named form fields are promoted to direct children of the form node and effectively override the attribute nodes when attribute names and field names collide.

Change History (1)

comment:1 Changed 10 years ago by dmethvin

Resolution: duplicate
Status: newclosed

This is a duplicate of #3113.

Note: See TracTickets for help on using tickets.