ladybird/Tests/LibWeb/Text/input/HTMLLinkElement-explicitly-enabled-alternative-stylesheets.html
Tim Ledbetter 4a3497e9cd LibWeb: Support loading alternative style sheets
Alternative style sheets are now fetched and are applied to the
document if they are explicitly enabled by removing the disabled
attribute.
2024-04-17 07:12:44 +02:00

21 lines
1.1 KiB
HTML

<!DOCTYPE html>
<script src="include.js"></script>
<link title="preferred" disabled rel="stylesheet" href="data:text/css,html { background: rgb(255, 0, 0) }">
<link title="alternative" disabled rel="alternate stylesheet" href="data:text/css,html { background: rgb(0, 128, 0) !important }">
<script>
asyncTest(done => {
const documentStyle = getComputedStyle(document.documentElement);
println(`background color initial value: ${documentStyle.backgroundColor}`);
const primaryLink = document.querySelector("link[title=preferred]");
const alternativeLink = document.querySelector("link[title=alternative]");
primaryLink.onload = () => {
println(`background color after preferred style sheet enabled: ${documentStyle.backgroundColor}`);
alternativeLink.disabled = false;
};
alternativeLink.onload = () => {
println(`background color after alternate style sheet enabled: ${documentStyle.backgroundColor}`);
done();
};
primaryLink.disabled = false;
});
</script>