Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up"If an element listed in a form element's past names map changes form owner, then its entries must be removed from that map." #25429
Labels
Comments
|
Good catch! |
|
The last test in html/semantics/forms/the-form-element/form-nameditem.html covers this thoroughly, associating, renaming, and disassociating elements in many ways; the first assert we fail on is when it uses .remove() on a renamed element and expects that to remove the past names map entry for its previous name. |
bors-servo
added a commit
that referenced
this issue
Jan 8, 2020
Past names expire when form owner is reset <!-- Please describe your changes on the following line: --> On their way out of form.controls, elements now also leave form.past_names_map, passing one WPT test. We're already scanning linearly through form.controls linearly to get the index of the control there, so additionally scanning through the past names map by value shouldn't raise any particular performance concern. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25429 <!-- Either: --> - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
bors-servo
added a commit
that referenced
this issue
Jan 8, 2020
Past names expire when form owner is reset <!-- Please describe your changes on the following line: --> On their way out of form.controls, elements now also leave form.past_names_map, passing one WPT test. We're already scanning linearly through form.controls linearly to get the index of the control there, so additionally scanning through the past names map by value shouldn't raise any particular performance concern. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25429 <!-- Either: --> - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
bors-servo
added a commit
that referenced
this issue
Jan 8, 2020
Past names expire when form owner is reset <!-- Please describe your changes on the following line: --> On their way out of form.controls, elements now also leave form.past_names_map, passing one WPT test. We're already scanning linearly through form.controls linearly to get the index of the control there, so additionally scanning through the past names map by value shouldn't raise any particular performance concern. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25429 <!-- Either: --> - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This requirement is placed in an easily missable location after the steps of https://html.spec.whatwg.org/multipage/forms.html#the-form-element:radionodelist-4 and doesn't even seem to have its own anchor to direct-link to. I think it can be satisfied by having each form-associated element's set_form_owner notify the old owner that it's leaving before changing to a new owner.
servo/components/script/dom/htmlinputelement.rs
Lines 1688 to 1690 in 2488213
This would first check if form_owner.get is_some and is different from form, and if so call something like form_owner.get().unwrap().remove_from_past_names_map(self), and likewise for every other element class with impl FormControls.
Another idea I had would be to just check, when getting from the map, if it's still owned, but that would be observably different in a case where it stopped being owned and then started being owned again.