We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fe89b67 commit 9f4078dCopy full SHA for 9f4078d
cd.js
@@ -1,7 +1,7 @@
1
import { getChildFromSinglePath } from './getChildFromSinglePath.js';
2
export function cd(el, path, pathHistory) {
3
const splitPath = path.split('/');
4
- let ctx = el;
+ let ctx = path.startsWith('/') ? document.body : el;
5
splitPath.forEach(token => {
6
if (!token)
7
return;
cd.ts
@@ -2,7 +2,7 @@ import {getChildFromSinglePath} from './getChildFromSinglePath.js';
export function cd(el: HTMLElement, path: string, pathHistory?: string[]){
splitPath.forEach(token =>{
if(!token) return;
8
if(pathHistory) pathHistory.push(token);
0 commit comments