This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
https://dom.spec.whatwg.org/#mutation-method-macro (as of rev b7563aa) Given one of the operations that references it, e.g.: void prepend((Node or DOMString)... nodes); Per Web IDL, the variadic argument can be omitted entirely, so e.g. myDiv.prepend() should not throw (unless specified to in prose). The various operations don't specify special handling when called with no arguments. They execute the mutation method macro, which has: 1. Let /node/ be null. 2. Replace each string in /nodes/ with a Text node whose data is the string value. 3. If /nodes/ contains more than one node, set /node/ to a new DocumentFragment and append each node in /nodes/ to it. Rethrow any exceptions. Otherwise, set /node/ to the single node /nodes/ contains. Step 3 doesn't appear to handle the case if /nodes/ contains zero nodes. It's not more than one, but yet not a single node. Proposed fix: Replace "contains more than one node" with "contains exactly one node". This would result in an empty DocumentFragment, which turns most of the ParentNode/ChildNode operations into no-ops when called with no argument except `replaceWith` which acts like `remove`.
Oops, not "contains exactly one" since that inverts the meaning of the test. "Contains more or less than one node", or flip the then/otherwise clauses, or explicitly handle 0. Whatevs.
This is now https://github.com/whatwg/dom/issues/44 since it got reported again and GitHub is somewhat nicer. I like your suggestion.