From 09b712f04690c0beeff4068d3f5239c6da2f79a0 Mon Sep 17 00:00:00 2001 From: Makin Date: Wed, 18 Jun 2025 18:40:20 +0200 Subject: prevent expensive Tag.traceError outside debug context --- src/html.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/html.js b/src/html.js index 3bec4269..3b399079 100644 --- a/src/html.js +++ b/src/html.js @@ -352,12 +352,13 @@ export class Tag { #traceError = null; constructor(tagName, attributes, content) { - this.tagName = tagName; - this.attributes = attributes; - this.content = content; - + this.tagName = tagName; + this.attributes = attributes; + this.content = content; + if (process.env.DEBUG) { this.#traceError = new Error(); } +} clone() { return Reflect.construct(this.constructor, [ -- cgit 1.3.0-6-gf8a5