LibWeb: Only invalidate style & DOM version if attribute really changes

When setting an element attribute to the value it already had, we don't
need to update style or invalidate anything that depends on the DOM
version counter.

This was a source of much pointless busywork.
This commit is contained in:
Andreas Kling 2024-09-04 10:14:36 +02:00 committed by Andreas Kling
parent ddbfac38b0
commit 7df4365e40
Notes: github-actions[bot] 2024-09-08 07:46:29 +00:00

View file

@ -448,9 +448,11 @@ void Element::run_attribute_change_steps(FlyString const& local_name, Optional<S
// AD-HOC: Run our own internal attribute change handler.
attribute_changed(local_name, old_value, value);
invalidate_style_after_attribute_change(local_name);
document().bump_dom_tree_version();
if (old_value != value) {
invalidate_style_after_attribute_change(local_name);
document().bump_dom_tree_version();
}
}
void Element::attribute_changed(FlyString const& name, Optional<String> const&, Optional<String> const& value)