summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-02-15 19:15:11 +0100
committerAndreas Kling <kling@serenityos.org>2022-02-15 23:24:41 +0100
commitbdf0254b1679ed2d041fccdf6b3d7fb1313e0405 (patch)
treecb09bc77f393a224fb8c9c91bbafeff5bf5869dc
parente91b2c57c197604943bf2c59aea2c5a843243c29 (diff)
downloadserenity-bdf0254b1679ed2d041fccdf6b3d7fb1313e0405.zip
LibWeb: Add Element::did_remove_attribute() virtual
This allows subclasses to react to DOM attributes being removed.
-rw-r--r--Userland/Libraries/LibWeb/DOM/Element.cpp2
-rw-r--r--Userland/Libraries/LibWeb/DOM/Element.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp
index 3725aa9818..9f42142c2d 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Element.cpp
@@ -161,6 +161,8 @@ void Element::remove_attribute(const FlyString& name)
{
m_attributes->remove_attribute(name);
+ did_remove_attribute(name);
+
// FIXME: Invalidate less.
document().invalidate_style();
}
diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h
index 4242c6d5eb..03a6fecff1 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.h
+++ b/Userland/Libraries/LibWeb/DOM/Element.h
@@ -83,6 +83,7 @@ public:
virtual void apply_presentational_hints(CSS::StyleProperties&) const { }
virtual void parse_attribute(const FlyString& name, const String& value);
+ virtual void did_remove_attribute(FlyString const&) { }
void recompute_style();