Und noch eins: selectNodeContents (Range) schlägt auch fehl, wenn man da als „Vater des Reiches“ ein Fragment einsetzen möchte:
const fragment = new DocumentFragment();
const selector = 'ol:has(+div>header+ol)';
…
for (
const odho = [ ... fragment.querySelectorAll(selector) ];
// klappt, da *nicht* nach '> ol…' gefragt wird
// = irgendwie seltsam!
odho.length;
) {
// odho? Vgl. Selektor!
const ol = odho.shift();
const div = ol.nextElementSibling;
const hdr = div.firstElementChild;
const reihe = div.lastElementChild;
const frame = document.createElement('section');
const blockRange = new Range();
// blockRange.selectNodeContents(ol.parentElement); ➾ throw:
// TypeError: Range.selectNodeContents:
// Argument 1 is not an object.
// blockRange.selectNode(ol); // hilft auch nicht weiter
blockRange.setStartBefore(ol); // klappt noch
blockRange.setEndAfter(reihe); // †
// Range braucht ein Elternteil, sonst stirbt es
// an innerlicher Zerrissenheit:
// InvalidStateError:
// An attempt was made to use an object
// that is not, or is no longer, usable
blockRange.surroundContents(frame); // throws
… // hier *sollten* die OL miteinander „gefilter-mischt“
… // und der Header nach vorne gestellt werden …