mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-07 00:19:27 +00:00
LibWeb: Port attribute change steps from DeprecatedFlyString
This commit is contained in:
parent
b337b4370a
commit
7e9a40dbad
|
@ -115,7 +115,7 @@ void Attr::handle_attribute_changes(Element& element, Optional<DeprecatedString>
|
|||
}
|
||||
|
||||
// 3. Run the attribute change steps with element, attribute’s local name, oldValue, newValue, and attribute’s namespace.
|
||||
element.run_attribute_change_steps(local_name(), old_value, new_value, deprecated_namespace_uri);
|
||||
element.run_attribute_change_steps(local_name(), old_value, new_value, namespace_uri());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ Element::Element(Document& document, DOM::QualifiedName qualified_name)
|
|||
// https://dom.spec.whatwg.org/#ref-for-concept-element-attributes-change-ext①
|
||||
add_attribute_change_steps([this](auto const& local_name, auto const& old_value, auto const& value, auto const& namespace_) {
|
||||
// 1. If localName is slot and namespace is null, then:
|
||||
if (local_name == HTML::AttributeNames::slot && namespace_.is_null()) {
|
||||
if (local_name == HTML::AttributeNames::slot && !namespace_.has_value()) {
|
||||
// 1. If value is oldValue, then return.
|
||||
if (value == old_value)
|
||||
return;
|
||||
|
@ -466,7 +466,7 @@ void Element::add_attribute_change_steps(AttributeChangeSteps steps)
|
|||
m_attribute_change_steps.append(move(steps));
|
||||
}
|
||||
|
||||
void Element::run_attribute_change_steps(FlyString const& local_name, Optional<DeprecatedString> const& old_value, Optional<DeprecatedString> const& value, DeprecatedFlyString const& namespace_)
|
||||
void Element::run_attribute_change_steps(FlyString const& local_name, Optional<DeprecatedString> const& old_value, Optional<DeprecatedString> const& value, Optional<FlyString> const& namespace_)
|
||||
{
|
||||
for (auto const& attribute_change_steps : m_attribute_change_steps)
|
||||
attribute_change_steps(local_name, old_value, value, namespace_);
|
||||
|
|
|
@ -146,10 +146,10 @@ public:
|
|||
virtual void apply_presentational_hints(CSS::StyleProperties&) const { }
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-element-attributes-change-ext
|
||||
using AttributeChangeSteps = Function<void(FlyString const& /*local_name*/, Optional<DeprecatedString> const& /*old_value*/, Optional<DeprecatedString> const& /*value*/, DeprecatedFlyString const& /*namespace_*/)>;
|
||||
using AttributeChangeSteps = Function<void(FlyString const& local_name, Optional<DeprecatedString> const& old_value, Optional<DeprecatedString> const& value, Optional<FlyString> const& namespace_)>;
|
||||
|
||||
void add_attribute_change_steps(AttributeChangeSteps steps);
|
||||
void run_attribute_change_steps(FlyString const& local_name, Optional<DeprecatedString> const& old_value, Optional<DeprecatedString> const& value, DeprecatedFlyString const& namespace_);
|
||||
void run_attribute_change_steps(FlyString const& local_name, Optional<DeprecatedString> const& old_value, Optional<DeprecatedString> const& value, Optional<FlyString> const& namespace_);
|
||||
virtual void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value);
|
||||
|
||||
struct [[nodiscard]] RequiredInvalidationAfterStyleChange {
|
||||
|
|
|
@ -18,7 +18,7 @@ HTMLSlotElement::HTMLSlotElement(DOM::Document& document, DOM::QualifiedName qua
|
|||
// https://dom.spec.whatwg.org/#ref-for-concept-element-attributes-change-ext
|
||||
add_attribute_change_steps([this](auto const& local_name, auto const& old_value, auto const& value, auto const& namespace_) {
|
||||
// 1. If element is a slot, localName is name, and namespace is null, then:
|
||||
if (local_name == AttributeNames::name && namespace_.is_null()) {
|
||||
if (local_name == AttributeNames::name && !namespace_.has_value()) {
|
||||
// 1. If value is oldValue, then return.
|
||||
if (value == old_value)
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue