Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"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

Closed
pshaughn opened this issue Jan 4, 2020 · 2 comments
Assignees
Labels

Comments

@pshaughn
Copy link
Member

@pshaughn pshaughn commented Jan 4, 2020

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.

fn set_form_owner(&self, form: Option<&HTMLFormElement>) {
self.form_owner.set(form);
}

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.

@jdm jdm added the A-content/dom label Jan 4, 2020
@jdm
Copy link
Member

@jdm jdm commented Jan 4, 2020

Good catch!

@pshaughn
Copy link
Member Author

@pshaughn pshaughn commented Jan 6, 2020

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.

@pshaughn pshaughn mentioned this issue Jan 6, 2020
4 of 4 tasks complete
@pshaughn pshaughn self-assigned this Jan 7, 2020
@pshaughn pshaughn mentioned this issue Jan 7, 2020
4 of 4 tasks complete
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. -->
@bors-servo bors-servo closed this in ed56927 Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.