demo · v132
What happens when the target element changes?
A RestrictionTarget is a one-shot snapshot of an element's identity. Re-render the target, detach it, move it across DOM — the restriction track has to react to all of these. Walk through the four common lifecycle events and see what the spec promises.
spec excerpt
// from w3c mediacapture-region spec
//
// A RestrictionTarget identifies an Element by an opaque token,
// not by DOM reference. The token survives reparenting but not
// element replacement.
//
// If the target Element is no longer reachable from a window's
// document at frame production time:
// - the track produces empty frames (background colour)
// - .restrictTo()'s most recent promise has already resolved,
// so no rejection occurs; the consumer sees blank output
//
// If a new Element with the same id replaces the original:
// - the RestrictionTarget DOES NOT re-attach
// - call .restrictTo() again with a fresh fromElement()