We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
children
1 parent 0fde1e1 commit be332dcCopy full SHA for be332dc
packages/runtime-vapor/src/dom/template.ts
@@ -13,9 +13,14 @@ export function template(html: string) {
13
/*! #__NO_SIDE_EFFECTS__ */
14
export function children(node: Node, ...paths: number[]): Node {
15
for (const idx of paths) {
16
- for (let i = 0; i <= idx; i++) {
17
- node = node[i === 0 ? 'firstChild' : 'nextSibling']!
18
- }
+ // In various situations, select the quickest approach.
+ // See https://github.com/vuejs/core-vapor/pull/263
+ node =
19
+ idx === 0
20
+ ? node.firstChild!
21
+ : idx === 1
22
+ ? node.firstChild!.nextSibling!
23
+ : node.childNodes[idx]
24
}
25
return node
26
0 commit comments