mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibWeb: Re-evaluate the style block when the type attribute changes
Some checks are pending
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This commit is contained in:
parent
4d17707b26
commit
bd9d489370
Notes:
github-actions[bot]
2025-04-28 23:01:58 +00:00
Author: https://github.com/h2337 🔰
Commit: bd9d489370
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4511
3 changed files with 49 additions and 0 deletions
|
@ -59,6 +59,8 @@ void HTMLStyleElement::attribute_changed(FlyString const& name, Optional<String>
|
|||
if (name == HTML::AttributeNames::media) {
|
||||
if (auto* sheet = m_style_element_utils.sheet())
|
||||
sheet->set_media(value.value_or({}));
|
||||
} else if (name == HTML::AttributeNames::type) {
|
||||
m_style_element_utils.update_a_style_block(*this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
Harness status: OK
|
||||
|
||||
Found 3 tests
|
||||
|
||||
3 Pass
|
||||
Pass Check initial styleSheets length type
|
||||
Pass Change type from invalid type to valid type
|
||||
Pass Change type from valid type to invalid type
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Dynamically changing HTMLStyleElement.type should change the rendering accordingly</title>
|
||||
<script src="../../../../resources/testharness.js"></script>
|
||||
<script src="../../../../resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-style-element">
|
||||
<style type="no/mime">
|
||||
body { color: green }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
Text content.
|
||||
<script>
|
||||
var style = document.querySelector("style");
|
||||
test(function() {
|
||||
assert_equals(document.styleSheets.length, 0);
|
||||
}, "Check initial styleSheets length type");
|
||||
|
||||
test(function() {
|
||||
assert_not_equals(getComputedStyle(document.querySelector("body")).color, "rgb(0, 128, 0)");
|
||||
assert_equals(document.styleSheets.length, 0);
|
||||
style.type = "text/css";
|
||||
assert_equals(getComputedStyle(document.querySelector("body")).color, "rgb(0, 128, 0)");
|
||||
assert_equals(document.styleSheets.length, 1);
|
||||
}, "Change type from invalid type to valid type");
|
||||
|
||||
test(function() {
|
||||
assert_equals(getComputedStyle(document.querySelector("body")).color, "rgb(0, 128, 0)");
|
||||
assert_equals(document.styleSheets.length, 1);
|
||||
style.type = "no/mime";
|
||||
assert_not_equals(getComputedStyle(document.querySelector("body")).color, "rgb(0, 128, 0)");
|
||||
assert_equals(document.styleSheets.length, 0);
|
||||
}, "Change type from valid type to invalid type");
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue