mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:05:07 +00:00
LibWeb: Add fieldset elements property
This commit is contained in:
parent
0fe192dfd9
commit
ea04a86715
6 changed files with 66 additions and 1 deletions
|
@ -5,8 +5,14 @@
|
|||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/HTML/HTMLButtonElement.h>
|
||||
#include <LibWeb/HTML/HTMLFieldSetElement.h>
|
||||
#include <LibWeb/HTML/HTMLInputElement.h>
|
||||
#include <LibWeb/HTML/HTMLLegendElement.h>
|
||||
#include <LibWeb/HTML/HTMLObjectElement.h>
|
||||
#include <LibWeb/HTML/HTMLOutputElement.h>
|
||||
#include <LibWeb/HTML/HTMLSelectElement.h>
|
||||
#include <LibWeb/HTML/HTMLTextAreaElement.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -25,6 +31,12 @@ void HTMLFieldSetElement::initialize(JS::Realm& realm)
|
|||
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLFieldSetElementPrototype>(realm, "HTMLFieldSetElement"_fly_string));
|
||||
}
|
||||
|
||||
void HTMLFieldSetElement::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_elements);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#concept-fieldset-disabled
|
||||
bool HTMLFieldSetElement::is_disabled() const
|
||||
{
|
||||
|
@ -45,4 +57,23 @@ bool HTMLFieldSetElement::is_disabled() const
|
|||
return false;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-fieldset-elements
|
||||
JS::GCPtr<DOM::HTMLCollection> const& HTMLFieldSetElement::elements()
|
||||
{
|
||||
// The elements IDL attribute must return an HTMLCollection rooted at the fieldset element, whose filter matches listed elements.
|
||||
if (!m_elements) {
|
||||
m_elements = DOM::HTMLCollection::create(*this, DOM::HTMLCollection::Scope::Descendants, [](DOM::Element const& element) {
|
||||
// FIXME: Form-associated custom elements return also true
|
||||
return is<HTMLButtonElement>(element)
|
||||
|| is<HTMLFieldSetElement>(element)
|
||||
|| is<HTMLInputElement>(element)
|
||||
|| is<HTMLObjectElement>(element)
|
||||
|| is<HTMLOutputElement>(element)
|
||||
|| is<HTMLSelectElement>(element)
|
||||
|| is<HTMLTextAreaElement>(element);
|
||||
});
|
||||
}
|
||||
return m_elements;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue