Truly independent web browser
<!DOCTYPE html>
<script src="../../include.js"></script>
<style id="registrations"></style>
<style>
#target { color: black; }
#target::before { content: "x"; background-color: red; }
@container style(--pseudo-query: 10px) {
#target::before { background-color: green; }
}
</style>
<div><span id="target"></span></div>
<script>
promiseTest(async () => {
const target = document.getElementById("target");
internals.updateStyle();
const animation = target.animate([{ color: "rgb(200, 0, 0)" }, { color: "rgb(0, 0, 200)" }], { duration: 1000 });
animation.pause();
await animation.ready;
for (const currentTime of [250, 500, 750]) {
animation.currentTime = currentTime;
getComputedStyle(target).color;
}
internals.beginStyleTrace();
registrations.sheet.insertRule("@property --pseudo-query { syntax: '<length>'; inherits: false; initial-value: 10px; }");
internals.updateStyle();
println("style passes of the update:");
let inStylePass = false;
for (const line of internals.takeStyleTrace().split("\n")) {
if (line.startsWith("style "))
inStylePass = /^style (FULL|PARTIAL|COLD)$/.test(line);
if (inStylePass && line.trim())
println(` ${line}`);
}
println(`${getComputedStyle(target).color} ${getComputedStyle(target, "::before").color} ${getComputedStyle(target, "::before").backgroundColor}`);
});
</script>