Closed Bug 1318576 Opened 3 years ago Closed 3 years ago

Past names map is not updated when an element that no longer has a name/id is removed from the form

Categories

(Core :: DOM: Core & HTML, defect)

48 Branch
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: myvyang, Assigned: bzbarsky)

References

Details

Attachments

(2 files)

Attached file attr.html
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36

Steps to reproduce:

as code attached in attr.html

in other browsers, after removeChild, attributes will be update; but on firefox not.


Actual results:

in firefox, console shows `<input>`

in other browser ,like chrome, safari ,IE, console shows `NamedNodeMap`


Expected results:

run like other browser
Boris, can you check if Gecko behaves normaly according to the specs and the other browsers, please.
Component: Untriaged → DOM
Flags: needinfo?(bzbarsky)
Product: Firefox → Core
The relevant spec bit here is:

  If an element listed in a form element's past names map changes form owner, then its entries must be
  removed from that map.

We definitely have code to do that in HTMLFormElement::RemoveElementFromTable.  The problem is that this code is only called when the element has a name/id that should place it in the table.  I'll write up a fix.
Blocks: 879319
Summary: tag.attributes not update while tag's childNode update → Past names map is not updated when an element that no longer has a name/id is removed from the form
Assignee: nobody → bzbarsky
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(bzbarsky)
Comment on attachment 8812408 [details] [diff] [review]
Remove entries from a form's past names map when an element is removed from the form, even if that element doesn't have a name or id anymore

Review of attachment 8812408 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/html/HTMLFormElement.cpp
@@ +2560,5 @@
> +  if (!aElement->HasFlag(MAY_BE_IN_PAST_NAMES_MAP)) {
> +    return;
> +  }
> +
> +  aElement->UnsetFlags(MAY_BE_IN_PAST_NAMES_MAP);  

extra spaces.
Attachment #8812408 - Flags: review?(amarchesini) → review+
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/2a9eb529688b
Remove entries from a form's past names map when an element is removed from the form, even if that element doesn't have a name or id anymore.  r=baku
https://hg.mozilla.org/mozilla-central/rev/2a9eb529688b
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.