mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
add wpt tests
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
|
||||
function makeStaticNodeList(length) {
|
||||
const fooRoot = document.createElement("div");
|
||||
|
||||
for (var i = 0; i < length; i++) {
|
||||
const el = document.createElement("span");
|
||||
el.className = "foo";
|
||||
fooRoot.append(el);
|
||||
}
|
||||
|
||||
document.body.append(fooRoot);
|
||||
return fooRoot.querySelectorAll(".foo");
|
||||
}
|
||||
|
||||
const indexOfNodeList = new Function("nodeList", `
|
||||
const __cacheBust = ${Math.random()};
|
||||
|
||||
const el = nodeList[50];
|
||||
|
||||
let index = -1;
|
||||
|
||||
for (var i = 0; i < 1e5 / 2; i++) {
|
||||
for (var j = 0; j < nodeList.length; j++) {
|
||||
if (nodeList[j] === el) {
|
||||
index = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
`);
|
||||
|
||||
const arrayIndexOfNodeList = new Function("nodeList", `
|
||||
const __cacheBust = ${Math.random()};
|
||||
|
||||
const el = nodeList[50];
|
||||
const {indexOf} = Array.prototype;
|
||||
|
||||
for (var i = 0; i < 1e5; i++) {
|
||||
var index = indexOf.call(nodeList, el);
|
||||
}
|
||||
|
||||
return index;
|
||||
`);
|
||||
Reference in New Issue
Block a user