Bug 247593
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 |
Ahmad Saleem
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Karl Dubost
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
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
Pull request: https://github.com/WebKit/WebKit/pull/6437
EWS
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
<rdar://problem/102295475>