mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Implement PopoverInvokerElement
attribute change steps
PopoverInvokerElement's explicitly set attr-element should be set to null whenever the value of the `popovertarget` content attribute is changed.
This commit is contained in:
parent
40cb36607c
commit
022141647a
Notes:
github-actions[bot]
2024-12-14 20:12:21 +00:00
Author: https://github.com/tcl3
Commit: 022141647a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2891
7 changed files with 101 additions and 4 deletions
32
Libraries/LibWeb/HTML/PopoverInvokerElement.cpp
Normal file
32
Libraries/LibWeb/HTML/PopoverInvokerElement.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Tim Ledbetter <tim.ledbetter@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
#include <LibWeb/HTML/AttributeNames.h>
|
||||
#include <LibWeb/HTML/PopoverInvokerElement.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
void PopoverInvokerElement::associated_attribute_changed(FlyString const& name, Optional<String> const&, Optional<FlyString> const& namespace_)
|
||||
{
|
||||
// From: https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#reflecting-content-attributes-in-idl-attributess
|
||||
// For element reflected targets only: the following attribute change steps, given element, localName, oldValue, value, and namespace,
|
||||
// are used to synchronize between the content attribute and the IDL attribute:
|
||||
|
||||
// 1. If localName is not attr or namespace is not null, then return.
|
||||
if (name != HTML::AttributeNames::popovertarget || namespace_.has_value())
|
||||
return;
|
||||
|
||||
// 2. Set element's explicitly set attr-elements to null.
|
||||
m_popover_target_element = nullptr;
|
||||
}
|
||||
|
||||
void PopoverInvokerElement::visit_edges(JS::Cell::Visitor& visitor)
|
||||
{
|
||||
visitor.visit(m_popover_target_element);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue