RESOLVED FIXED 247593
Fix form association behavior when a form and a control with form= are removed from a document together
https://bugs.webkit.org/show_bug.cgi?id=247593
Summary Fix form association behavior when a form and a control with form= are remove...
Ahmad Saleem
Reported 2022-11-07 15:39:29 PST
Hi Team, I came across another Blink Commit, where Safari Technology Preview 157 is failing one particular test case: Commit - https://src.chromium.org/viewvc/blink?revision=197887&view=revision Webkit Source - https://github.com/WebKit/WebKit/blob/7f186f0d780258408c1166c9432377365fa5d5b3/Source/WebCore/html/FormAssociatedElement.cpp#L94 Test Case - https://jsfiddle.net/f407psh1/show Failing Test Case below: - Check if a form and a control are disassociated when they are removed from the document together. PASS owner.elements.length is 1 FAIL owner.elements.length should be 0. Was 1. ____ To do: if (!insertionType.connectedToDocument && element.hasAttributeWithoutSynchronization(formAttr)) { ** Whatever is here already. *** resetFormOwner(); return } We might need to add InsertionType to definition to "FormAssociatedElement.h" for "removedFromAncestor": https://github.com/WebKit/WebKit/blob/7f186f0d780258408c1166c9432377365fa5d5b3/Source/WebCore/html/FormAssociatedElement.h#L97 ___ Just wanted to create bug. Thanks!
Attachments
Karl Dubost
Comment 1 2022-11-07 18:32:35 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>
Ahmad Saleem
Comment 2 2022-11-08 15:19:09 PST
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
Ryosuke Niwa
Comment 3 2022-11-12 19:59:43 PST
EWS
Comment 4 2022-11-13 12:48:38 PST
Committed 256620@main (d16d7ec79683): <https://commits.webkit.org/256620@main> Reviewed commits have been landed. Closing PR #6437 and removing active labels.
Radar WebKit Bug Importer
Comment 5 2022-11-13 12:49:19 PST
Note You need to log in before you can comment on or make changes to this bug.