mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:27:34 +00:00
LibWeb: Invoke our internal attribute change handler from Attr
Currently, every public DOM::Element method which changes an attribute
fires this handler itself. This was missed in commit 720f7ba
, so any
user of that API would not fire the internal handler.
To fix this, and prevent any missing invocations in the future, invoke
the handler from from Attr::handle_attribute_changes. This method is
reached for all attribute changes, including adding/removing attributes.
This ensures the handler will always be fired, and reduces the footprint
of this ad-hoc behavior.
Note that our ad-hoc handler is not the "attribute change steps" noted
by the spec. Those are overridden only by a couple of specific elements,
e.g. HTMLSlotElement. However, we could easily make our ad-hoc handler
hook into those steps in the future.
This commit is contained in:
parent
9aae50a9c3
commit
5ec76331e8
3 changed files with 21 additions and 25 deletions
|
@ -128,6 +128,8 @@ public:
|
|||
Vector<FlyString> const& class_names() const { return m_classes; }
|
||||
|
||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const { }
|
||||
|
||||
void run_attribute_change_steps(DeprecatedFlyString const& local_name, DeprecatedString const& old_value, DeprecatedString const& value, DeprecatedFlyString const& namespace_);
|
||||
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value);
|
||||
|
||||
struct [[nodiscard]] RequiredInvalidationAfterStyleChange {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue