From d78177f127edcc93aec7cb7a343791ded7fdbe23 Mon Sep 17 00:00:00 2001 From: Tobias Buschor Date: Thu, 30 Jun 2022 20:09:46 +0200 Subject: [PATCH] fix path (reverse) --- tree1.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tree1.js b/tree1.js index 2638d78..474a8bc 100644 --- a/tree1.js +++ b/tree1.js @@ -198,8 +198,8 @@ export class tree extends HTMLElement { path(){ if (this.isRoot()) return [this]; - return [this].concat(this.parentNode.path()); // as we dont cache, we dont have to make a copy - // return this.isRoot() ? [this] : [...this.parentNode.path(), this]; + return this.parentNode.path().concat(this); + // return this.isRoot() ? [this] : [...this.parentNode.path(), this]; // as we dont cache, we dont have to make a copy } }