Truly independent web browser
<!DOCTYPE html>
<script src="../../include.js"></script>
<div id="host"><span id="light">light</span></div>
<script>
test(() => {
const root = host.attachShadow({ mode: "open" });
for (let i = 0; i < 25; ++i) {
const span = document.createElement("span");
span.textContent = "bystander";
root.appendChild(span);
}
getComputedStyle(light).color;
getComputedStyle(root.firstChild).color;
const style = document.createElement("style");
style.textContent = ":host > * { color: rgb(0, 128, 0); }";
root.appendChild(style);
println(`light child: ${getComputedStyle(light).color}`);
println(`shadow child: ${getComputedStyle(root.firstChild).color}`);
println(`shadow last child: ${getComputedStyle(root.children[24]).color}`);
});
</script>