diff --git a/cjs/mixin/parent-node.js b/cjs/mixin/parent-node.js index 47590b42..1aaa3e0d 100644 --- a/cjs/mixin/parent-node.js +++ b/cjs/mixin/parent-node.js @@ -52,14 +52,17 @@ class ParentNode extends Node { super(ownerDocument, localName, nodeType); this[PRIVATE] = null; /** @type {NodeStruct} */ - this[NEXT] = this[END] = { - [NEXT]: null, - [PREV]: this, - [START]: this, + // the links are added after the literal: a literal with symbol keys allocates through a + // slower path, and this marker is created for every node + const end = { nodeType: NODE_END, ownerDocument: this.ownerDocument, parentNode: null }; + end[NEXT] = null; + end[PREV] = this; + end[START] = this; + this[NEXT] = this[END] = end; } get childNodes() { diff --git a/esm/mixin/parent-node.js b/esm/mixin/parent-node.js index b54c4a0e..fcaa0a8e 100644 --- a/esm/mixin/parent-node.js +++ b/esm/mixin/parent-node.js @@ -51,14 +51,17 @@ export class ParentNode extends Node { super(ownerDocument, localName, nodeType); this[PRIVATE] = null; /** @type {NodeStruct} */ - this[NEXT] = this[END] = { - [NEXT]: null, - [PREV]: this, - [START]: this, + // the links are added after the literal: a literal with symbol keys allocates through a + // slower path, and this marker is created for every node + const end = { nodeType: NODE_END, ownerDocument: this.ownerDocument, parentNode: null }; + end[NEXT] = null; + end[PREV] = this; + end[START] = this; + this[NEXT] = this[END] = end; } get childNodes() {