perf: improve baseline speed by 30%
Use node.firstChild and node.nextSibling instead of node.children or node.childNodes in the baseline benchmark.
This commit is contained in:
@ -38,6 +38,9 @@ class DOM {
|
||||
static Node firstChild(el) {
|
||||
return el.firstChild;
|
||||
}
|
||||
static Node nextSibling(el) {
|
||||
return el.nextNode;
|
||||
}
|
||||
static Element parentElement(el) {
|
||||
return el.parent;
|
||||
}
|
||||
|
@ -31,6 +31,9 @@ export class DOM {
|
||||
static firstChild(el):Node {
|
||||
return el.firstChild;
|
||||
}
|
||||
static nextSibling(el):Node {
|
||||
return el.nextSibling;
|
||||
}
|
||||
static parentElement(el) {
|
||||
return el.parentElement;
|
||||
}
|
||||
|
Reference in New Issue
Block a user