2020-08-01 03:07:00 +01:00
|
|
|
/*
|
2021-04-28 22:46:44 +02:00
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
2022-02-26 11:43:52 +01:00
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
2020-08-01 03:07:00 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-08-01 03:07:00 +01:00
|
|
|
*/
|
|
|
|
|
2022-02-26 11:43:52 +01:00
|
|
|
#include <LibWeb/DOM/HTMLCollection.h>
|
|
|
|
#include <LibWeb/HTML/HTMLTableRowElement.h>
|
2020-08-01 03:07:00 +01:00
|
|
|
#include <LibWeb/HTML/HTMLTableSectionElement.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
2022-02-18 21:00:52 +01:00
|
|
|
HTMLTableSectionElement::HTMLTableSectionElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
2021-02-07 11:20:15 +01:00
|
|
|
: HTMLElement(document, move(qualified_name))
|
2020-08-01 03:07:00 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLTableSectionElement::~HTMLTableSectionElement()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-02-26 11:43:52 +01:00
|
|
|
// https://html.spec.whatwg.org/multipage/tables.html#dom-tbody-rows
|
|
|
|
NonnullRefPtr<DOM::HTMLCollection> HTMLTableSectionElement::rows() const
|
|
|
|
{
|
|
|
|
// The rows attribute must return an HTMLCollection rooted at this element,
|
|
|
|
// whose filter matches only tr elements that are children of this element.
|
|
|
|
// FIXME: This should return the same HTMLCollection object every time,
|
|
|
|
// but that would cause a reference cycle since HTMLCollection refs the root.
|
|
|
|
return DOM::HTMLCollection::create(const_cast<HTMLTableSectionElement&>(*this), [this](Element const& element) {
|
|
|
|
return element.parent() == this
|
|
|
|
&& is<HTMLTableRowElement>(element);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-08-01 03:07:00 +01:00
|
|
|
}
|