mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibWeb: Update Element class list is when class attribute is removed
This commit is contained in:
parent
6e77fff698
commit
21e21abeed
Notes:
github-actions[bot]
2024-07-25 04:44:34 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/21e21abeed1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/817
3 changed files with 18 additions and 2 deletions
3
Tests/LibWeb/Text/expected/DOM/Element-classList.txt
Normal file
3
Tests/LibWeb/Text/expected/DOM/Element-classList.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
element.classList initial value: ""
|
||||
element.classList after setting classList to "a": "a"
|
||||
element.classList after setting className to "": ""
|
13
Tests/LibWeb/Text/input/DOM/Element-classList.html
Normal file
13
Tests/LibWeb/Text/input/DOM/Element-classList.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const element = document.createElement("div");
|
||||
println(`element.classList initial value: "${element.classList.toString()}"`);
|
||||
element.classList = "a";
|
||||
println(`element.classList after setting classList to "a": "${element.classList.toString()}"`);
|
||||
element.className = "";
|
||||
println(`element.classList after setting className to "": "${element.classList.toString()}"`);
|
||||
});
|
||||
</script>
|
||||
</html>
|
|
@ -480,9 +480,9 @@ void Element::attribute_changed(FlyString const& name, Optional<String> const&,
|
|||
for (auto& new_class : new_classes) {
|
||||
m_classes.unchecked_append(FlyString::from_utf8(new_class).release_value_but_fixme_should_propagate_errors());
|
||||
}
|
||||
if (m_class_list)
|
||||
m_class_list->associated_attribute_changed(value_or_empty);
|
||||
}
|
||||
if (m_class_list)
|
||||
m_class_list->associated_attribute_changed(value_or_empty);
|
||||
} else if (name == HTML::AttributeNames::style) {
|
||||
if (!value.has_value()) {
|
||||
if (m_inline_style) {
|
||||
|
|
Loading…
Reference in a new issue