Skip to content

Commit 3381649

Browse files
author
blik
committed
return node from fragment/ascend
1 parent df752c2 commit 3381649

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Blik_2023_fragment.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -354,26 +354,26 @@
354354
if((selection||fragment)&&!defined(selector))selector="svg";
355355
let limited=numeric(selector);
356356
if(limited&&!selector)
357-
return [this];
357+
return [node];
358358
let matching=!limited&&(!/[\.#]/.test(selector)
359359
?node.nodeName.toLowerCase()===selector
360360
:functor(selector)
361-
?selector(this)
361+
?selector(node)
362362
:fragment
363363
?node.matches(selector)
364364
:// match selectors on node.
365-
[qualify(qualify(node)),prune.call({"":note(qualify(selector))},({1:value})=>
365+
[qualify(qualify(node)),prune.call({"":qualify(selector)},({1:value})=>
366366
Object.keys(value).every(field=>["id","class"].includes(field))?value:undefined,1,1)
367367
].map(Object.entries).reduce(([[nodename,node]],[[name,selector]])=>
368368
(!name||nodename===name)&&
369369
Object.entries(selector).every(([field,value])=>
370370
value.every(value=>node[field]?.includes(value)))));
371371
if(matching)
372-
return [this];
372+
return [node];
373373
let parent=fragment||selection?node.parentNode:node.parent;
374374
return !descendants.has(node)&&parent
375-
?[...ascend.call(selection?select(parent):parent,limited?selector-1:selector,descendants.add(node)),this]
376-
:[this];
375+
?[...ascend.call(parent,limited?selector-1:selector,descendants.add(node)),node]
376+
:[node];
377377
};
378378

379379
export function print(file)

0 commit comments

Comments
 (0)