From caab6e1830ce5292cf2485a8f7d88947a4955eb3 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Tue, 15 Oct 2024 16:23:00 -0400 Subject: [PATCH] Tighten up pre-move checks --- dom.bs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/dom.bs b/dom.bs index 56ece284..2e1e574f 100644 --- a/dom.bs +++ b/dom.bs @@ -2652,12 +2652,30 @@ of a node into a parent before a child, run the +

To ensure pre-move validity +of a node into a parent before a child, run these steps: + +

    +
  1. Assert: node is either an {{Element}} or {{CharacterData}}.

  2. + +
  3. If parent is not an {{Element}} node, then throw a + "{{HierarchyRequestError!!exception}}" {{DOMException}}. + +

  4. If node is a host-including inclusive ancestor of parent, then + throw a "{{HierarchyRequestError!!exception}}" {{DOMException}}. + +

  5. If child is non-null and its parent is not parent, + then throw a "{{NotFoundError!!exception}}" {{DOMException}}. +

+ +

The ensure pre-move validity steps are a similar, but slightly stricter version +of the ensure pre-insertion validity steps.

+

To pre-move a node into a parent before a child, run these steps:

    - -
  1. Ensure pre-insertion validity of node into parent before +

  2. Ensure pre-move validity of node into parent before child.

  3. Let referenceChild be child.