Closed Bug 1829038 Opened 2 years ago Closed 2 years ago

[wpt-sync] Sync PR 39615 - Make element references via idrefs functional when disconnected

Categories

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

task

Tracking

()

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Mason Freed <masonf@chromium.org> wrote:

Make element references via idrefs functional when disconnected

Per the spec [1], computing the attr-associated element does not
depend on connectedness. Step 4 (which runs whenever there is not
an explicitly set attr-element) says:


...return the first element candidate, in tree order, that meets the following criteria:

  • candidate's root is the same as element's root,
  • candidate's ID is contentAttributeValue, and
  • candidate implements T.

If no such element exists, then return null.

The issue prior to this CL is that getElementById() uses the
TreeOrderedMap, and elements are removed from the map when they are
removed from the document. A partial fix for non-idref (IDL) element
references was made with [2], and this is the second half.

[1] https://html.spec.whatwg.org/#attr-associated-element
[2] https://chromium-review.googlesource.com/c/chromium/src/+/4371122

Fixed:1427374
Change-Id: I2a089a5fa1a925d40761ae2275ed34f855791513

Reviewed-on: https://chromium-review.googlesource.com/4450333
WPT-Export-Revision: a85db43440805b1118de18cba5720eeb0669c3ad

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core
Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0a23fbd75fc9 [wpt PR 39615] - Make element references via idrefs functional when disconnected, a=testonly https://hg.mozilla.org/integration/autoland/rev/c58560aa8957 [wpt PR 39615] - Update wpt metadata, a=testonly
Test result changes from PR not available.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch
You need to log in before you can comment on or make changes to this bug.