Skip to content

Commit 9f4078d

Browse files
committed
...
1 parent fe89b67 commit 9f4078d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getChildFromSinglePath } from './getChildFromSinglePath.js';
22
export function cd(el, path, pathHistory) {
33
const splitPath = path.split('/');
4-
let ctx = el;
4+
let ctx = path.startsWith('/') ? document.body : el;
55
splitPath.forEach(token => {
66
if (!token)
77
return;

cd.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {getChildFromSinglePath} from './getChildFromSinglePath.js';
22

33
export function cd(el: HTMLElement, path: string, pathHistory?: string[]){
44
const splitPath = path.split('/');
5-
let ctx = el;
5+
let ctx = path.startsWith('/') ? document.body : el;
66
splitPath.forEach(token =>{
77
if(!token) return;
88
if(pathHistory) pathHistory.push(token);

0 commit comments

Comments
 (0)