Skip to content

Commit

Permalink
fix: parentElement not always available depending on context
Browse files Browse the repository at this point in the history
  • Loading branch information
Hadrien Lepoutre authored and jcbrand committed Jul 16, 2024
1 parent fc440af commit 39879c3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 39879c3

Please sign in to comment.