|
@@ -6,6 +6,7 @@
|
|
|
|
|
|
#include <LibWeb/Bindings/HTMLOutputElementPrototype.h>
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
|
|
+#include <LibWeb/DOM/DOMTokenList.h>
|
|
|
#include <LibWeb/HTML/HTMLOutputElement.h>
|
|
|
|
|
|
namespace Web::HTML {
|
|
@@ -25,6 +26,29 @@ void HTMLOutputElement::initialize(JS::Realm& realm)
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLOutputElement);
|
|
|
}
|
|
|
|
|
|
+void HTMLOutputElement::visit_edges(Cell::Visitor& visitor)
|
|
|
+{
|
|
|
+ Base::visit_edges(visitor);
|
|
|
+ visitor.visit(m_html_for);
|
|
|
+}
|
|
|
+
|
|
|
+void HTMLOutputElement::form_associated_element_attribute_changed(FlyString const& name, Optional<String> const& value)
|
|
|
+{
|
|
|
+ if (name == HTML::AttributeNames::for_) {
|
|
|
+ if (m_html_for)
|
|
|
+ m_html_for->associated_attribute_changed(value.value_or(String {}));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// https://html.spec.whatwg.org/multipage/form-elements.html#dom-output-htmlfor
|
|
|
+JS::NonnullGCPtr<DOM::DOMTokenList> HTMLOutputElement::html_for()
|
|
|
+{
|
|
|
+ // The htmlFor IDL attribute must reflect the for content attribute.
|
|
|
+ if (!m_html_for)
|
|
|
+ m_html_for = DOM::DOMTokenList::create(*this, HTML::AttributeNames::for_);
|
|
|
+ return *m_html_for;
|
|
|
+}
|
|
|
+
|
|
|
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-output-defaultvalue
|
|
|
String HTMLOutputElement::default_value() const
|
|
|
{
|