PopoverInvokerElement.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (c) 2024, Tim Ledbetter <tim.ledbetter@ladybird.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/DOM/Element.h>
  7. #include <LibWeb/HTML/AttributeNames.h>
  8. #include <LibWeb/HTML/PopoverInvokerElement.h>
  9. namespace Web::HTML {
  10. void PopoverInvokerElement::associated_attribute_changed(FlyString const& name, Optional<String> const&, Optional<FlyString> const& namespace_)
  11. {
  12. // From: https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#reflecting-content-attributes-in-idl-attributess
  13. // For element reflected targets only: the following attribute change steps, given element, localName, oldValue, value, and namespace,
  14. // are used to synchronize between the content attribute and the IDL attribute:
  15. // 1. If localName is not attr or namespace is not null, then return.
  16. if (name != HTML::AttributeNames::popovertarget || namespace_.has_value())
  17. return;
  18. // 2. Set element's explicitly set attr-elements to null.
  19. m_popover_target_element = nullptr;
  20. }
  21. void PopoverInvokerElement::visit_edges(JS::Cell::Visitor& visitor)
  22. {
  23. visitor.visit(m_popover_target_element);
  24. }
  25. }