mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
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.
This commit is contained in:
committed by
Andreas Kling
parent
25f8c26624
commit
4a3497e9cd
Notes:
sideshowbarker
2024-07-17 03:03:15 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/4a3497e9cd Pull-request: https://github.com/SerenityOS/serenity/pull/23992
@@ -0,0 +1,21 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user