FormAssociatedElement.cpp 519 B

123456789101112131415161718192021
  1. /*
  2. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/HTML/FormAssociatedElement.h>
  7. #include <LibWeb/HTML/HTMLFormElement.h>
  8. namespace Web::HTML {
  9. void FormAssociatedElement::set_form(HTMLFormElement* form)
  10. {
  11. if (m_form)
  12. m_form->remove_associated_element({}, form_associated_element_to_html_element());
  13. m_form = form;
  14. if (m_form)
  15. m_form->add_associated_element({}, form_associated_element_to_html_element());
  16. }
  17. }