[whatwg/dom] Move [append|replace|remove]Child() and insertBefore() from Node to ParentNode (#669)

Currently, [`Node`](https://dom.spec.whatwg.org/#node) defines these methods

    insertBefore(Node node, Node? child);
    appendChild(Node node);
    replaceChild(Node node, Node child);
    removeChild(Node child);

as its members, but I think they should be moved to [`ParentNode`](https://dom.spec.whatwg.org/#parentnode).

My reasoning is that leaf-type nodes, such as [`Comment`](https://dom.spec.whatwg.org/#comment), [`Text`](https://dom.spec.whatwg.org/#text) and [`ProcessingInstruction`](https://dom.spec.whatwg.org/#processinginstruction), are derivatives of `Node`, yet don't allow any child nodes. Because of this they should currently throw a [`HierarchyRequestError`](https://heycam.github.io/webidl/#hierarchyrequesterror) when any of the mentioned methods are called on them (as per step 1. of the [**ensure pre-insertion validity**](https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity)  check, in the **Mutation algorithms** section).

Step 1. in this **ensure pre-insertion validity** check could, however, be made obsolete if the mentioned methods would be moved to `ParentNode`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/669

Received on Wednesday, 25 July 2018 02:04:39 UTC