Closed Bug 2066850 Opened 3 months ago Closed 3 months ago

[wpt-sync] Sync PR 62217 - Add parser tests for foster parenting into a template

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
156 Branch
Tracking Status
firefox156 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Attachments

(1 file)

Sync web-platform-tests PR 62217 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/62217
Details from upstream follow.

Anne van Kesteren <annevk@annevk.nl> wrote:

Add parser tests for foster parenting into a template

Three foster parenting paths that had no coverage. Found while reviewing https://github.com/whatwg/html/pull/12831, which rewrites "appropriate place for inserting a node".

template-for-foster-parenting.html gains a second case: foster parenting out of a <tr> inside a <template for>, where the template is the last template on the stack of open elements and there is no table on the stack at all. The content has to go to the template's insertion target — a <template for> element is never inserted into the DOM, so resolving to its template contents loses the content, which is the same failure the existing case in that file was written to catch. The existing case only covers the shape where the template is older than the table and foster parenting therefore resolves through the last table instead.

template.dat gains <table><template><tr><div></div></tr></template>, the same shape for a plain <template> nested in a <table> so that the last table is non-null. It sits next to the existing <body><template><tr><div></div></tr></template> case, which has no table.

foster-parenting-into-template-element.html is new: script makes a template element the parent of the last table, so foster parenting resolves to a template element and has to redirect into its contents. The template has no insertion target, so the position before the table is dropped and the content appended.

Results in the three engines:

Chrome Canary 154 Safari Firefox
template-for-foster-parenting.html pass — —
template.dat pass — —
foster-parenting-into-template-element.html fail (dropped) pass fail

The last row is a known divergence, not a new requirement: Chrome and Firefox drop the element rather than inserting it. That is what keeping the reference child across the template redirect would produce, since the table is not a child of the template contents; the spec resets it to null. Filed here as-is since Safari matches the specification.

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core
Attached file Notable wpt changes —

CI Results

Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 278 tests and 14 subtests

Status Summary

Firefox

OK : 2[GitHub] 270[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 6[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 7771[Gecko-android-em-14-x86_64-lite-opt-geckoview] 7777[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
FAIL: 7[GitHub] 785[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]

Chrome

OK : 2
PASS: 6
FAIL: 1

Safari

OK : 2
PASS: 1
FAIL: 6

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

(See attachment for full changes)

Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 156 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: