Truly independent web browser
<!DOCTYPE html>
<script src="../include.js"></script>
<div id="target" style="--some-url: 'awesome.png'"></div>
<script>
test(() => {
let target = document.getElementById("target");
const directory = new URL(".", location.href).href;
const computedImage = () => getComputedStyle(target).backgroundImage.replace(directory, "[test-directory]/");
println(`Before: ${computedImage()}`);
target.style.backgroundImage = "url('cool.png')";
println(`Using url('cool.png'): ${computedImage()}`);
target.style.backgroundImage = "";
target.style.backgroundImage = "url(var(--some-url))";
println(`Using url(var(--some-url)): ${computedImage()}`);
target.style.backgroundImage = "";
target.style.backgroundImage = "src('cool.png')";
println(`Using src('cool.png'): ${computedImage()}`);
target.style.backgroundImage = "";
target.style.backgroundImage = "src(var(--some-url))";
println(`Using src(var(--some-url)): ${computedImage()}`);
});
</script>