| Summary: | Fix form association behavior when a form and a control with form= are removed from a document together | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> |
| Component: | Forms | Assignee: | Ryosuke Niwa <rniwa> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | akeerthi, cdumez, karlcow, rniwa, webkit-bug-importer, wenson_hsieh |
| Priority: | P2 | Keywords: | BrowserCompat, InRadar |
| Version: | Safari Technology Preview | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=247651 | ||
|
Description
Ahmad Saleem
2022-11-07 15:39:29 PST
The test case being
debug('- Check if a form and a control are disassociated when they are removed from the document together.');
container.innerHTML = '<div><input form=owner><form id=owner></form></div>';
owner = document.getElementById('owner');
shouldBe('owner.elements.length', '1');
container.firstChild.remove();
shouldBe('owner.elements.length', '0');
There is another sets of tests failing in this example.
https://jsfiddle.net/f407psh1/show
Probably worth a separate bug.
With a form/option without a select element
data:text/html,<form%20id=firstOwner><option%20id=firstOption></option></form>
and in the console:
document.querySelector('#firstOption').form
returns
null in Firefox and Chrome
The current HTMLFormElement() in Safari
Same for
data:text/html,<form id=secondOwner><optgroup><option id=secondOption></option></optgroup></form>
I tried doing this change in following PR but failing because of HTMLObjectElement.cpp using same "removedFromAncestor" and when I modify it as well then I get following build error while also modifying "HTMLObjectElement.h": error: non-virtual member function marked 'final' hides virtual member function I am still learning C++ so I might not be able to solve it and is closing my PR for someone else to fix this: https://github.com/WebKit/WebKit/pull/6229 Pull request: https://github.com/WebKit/WebKit/pull/6437 Committed 256620@main (d16d7ec79683): <https://commits.webkit.org/256620@main> Reviewed commits have been landed. Closing PR #6437 and removing active labels. |