
The new event target implementation requires us to downcast an EventTarget to a FormAssociatedElement to check if the current Element EventTarget has a form owner to setup a with scope for the form owner. This also makes all form associated elements inherit from FormAssociatedElement where it was previously missing. https://html.spec.whatwg.org/#form-associated-element
34 lines
703 B
C++
34 lines
703 B
C++
/*
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/WeakPtr.h>
|
|
#include <LibWeb/Forward.h>
|
|
#include <LibWeb/HTML/HTMLElement.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
class FormAssociatedElement : public HTMLElement {
|
|
public:
|
|
HTMLFormElement* form() { return m_form; }
|
|
HTMLFormElement const* form() const { return m_form; }
|
|
|
|
void set_form(HTMLFormElement*);
|
|
|
|
protected:
|
|
FormAssociatedElement(DOM::Document& document, QualifiedName qualified_name)
|
|
: HTMLElement(document, move(qualified_name))
|
|
{
|
|
}
|
|
|
|
virtual ~FormAssociatedElement() = default;
|
|
|
|
private:
|
|
WeakPtr<HTMLFormElement> m_form;
|
|
};
|
|
|
|
}
|