Closed Bug 1404864 Opened 2 years ago Closed 2 years ago

ensure HTMLInputElement.form works per spec in Shadow DOM

Categories

(Core :: DOM: Core & HTML, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: heycam, Assigned: smaug)

References

Details

Attachments

(1 file, 1 obsolete file)

No description provided.
Cameron, which spec do you refer to? Can you attach URL on the bug?
Flags: needinfo?(cam)
I don't know that there is currently a problem.  In bug 1404180 comment 6 smaug asked me to file this bug to make sure we get the behavior right.

That bug was about associating form control elements with <form>s, so the stuff that happens in nsGenericHTMLElement::UpdateFormOwner.  I think, although it's not exactly clear to me, that only <form> elements in the same shadow tree should be considered.

https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#association-of-controls-and-forms

We should also verify that we have the correct behavior for <fieldset> association, in nsGenericHTMLElement::UpdateFieldSet, when shadow trees are involved.
Flags: needinfo?(cam)
Priority: -- → P2
https://github.com/w3c/webcomponents/issues/196

So, we don't want to cross shadow tree boundaries when finding a form owner.
Assignee: nobody → jjong
Depends on: 1460435
remote: View your changes here:
remote:   https://hg.mozilla.org/try/rev/eb1f4921a27daa8027f70808f2d1b81b11e97075
remote:   https://hg.mozilla.org/try/rev/7f53d74a3588e714bca7fb5c2fc908ff8eda6399
remote: 
remote: Follow the progress of your build on Treeherder:
remote:   https://treeherder.mozilla.org/#/jobs?repo=try&revision=7f53d74a3588e714bca7fb5c2fc908ff8eda6399
remote: recorded changegroup in replication log in 0.103s
Assignee: jessi3py → bugs
Status: NEW → ASSIGNED
Attachment #8975124 - Flags: review?(peterv)
Blocks: 1461321
Looks like there is a wpt test which passes with this change,
TEST-UNEXPECTED-PASS | /shadow-dom/untriaged/shadow-trees/upper-boundary-encapsulation/test-007.html | A_04_01_07_T02
So mozilla-central/testing/web-platform/meta/shadow-dom/untriaged/shadow-trees/upper-boundary-encapsulation/test-007.html.ini could be removed
Comment on attachment 8975124 [details] [diff] [review]
form_attribute_in_shadow_dom.diff

Review of attachment 8975124 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/html/nsGenericHTMLElement.cpp
@@ +2134,3 @@
>  
>    nsAutoString formId;
> +  DocumentOrShadowRoot* docOrShadow = GetUncomposedDocOrConnectedShadowRoot();

Nit: you could just assert non-null docOrShadow here instead? Not sure the assertion is very useful anyway, we'll crash immediately below.
Attachment #8975124 - Flags: review?(peterv) → review+
yeah, the assertion isn't too useful. I guess I should just remove it.
Attachment #8975124 - Attachment is obsolete: true
Pushed by opettay@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/69256fdf60d6
ensure HTMLInputElement.form works per spec in Shadow DOM, r=peterv
Created web-platform-tests PR https://github.com/w3c/web-platform-tests/pull/11077 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
https://hg.mozilla.org/mozilla-central/rev/69256fdf60d6
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
Upstream PR merged
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.