From 39879c3f56fa8b0297e142bd1cdd606fb15091ba Mon Sep 17 00:00:00 2001 From: Hadrien Lepoutre Date: Mon, 15 Jul 2024 10:48:32 +0200 Subject: [PATCH] fix: parentElement not always available depending on context --- src/builder.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/builder.js b/src/builder.js index ccf8e1f9..cf4817ce 100644 --- a/src/builder.js +++ b/src/builder.js @@ -173,7 +173,8 @@ class Builder { * @return {Builder} The Strophe.Builder object. */ up() { - this.node = this.node.parentElement; + // Depending on context, parentElement is not always available + this.node = this.node.parentElement ? this.node.parentElement : /** @type {Element} */ (this.node.parentNode); return this; }