ladybird/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp
Lenny Maiorani c37820b898 Libraries: Use default constructors/destructors in LibWeb
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-17 17:23:49 +00:00

34 lines
1.1 KiB
C++

/*
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/DOM/HTMLCollection.h>
#include <LibWeb/HTML/HTMLTableCellElement.h>
#include <LibWeb/HTML/HTMLTableRowElement.h>
namespace Web::HTML {
HTMLTableRowElement::HTMLTableRowElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: HTMLElement(document, move(qualified_name))
{
}
HTMLTableRowElement::~HTMLTableRowElement() = default;
// https://html.spec.whatwg.org/multipage/tables.html#dom-tr-cells
NonnullRefPtr<DOM::HTMLCollection> HTMLTableRowElement::cells() const
{
// The cells attribute must return an HTMLCollection rooted at this tr element,
// whose filter matches only td and th elements that are children of the tr 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<HTMLTableRowElement&>(*this), [this](Element const& element) {
return element.parent() == this
&& is<HTMLTableCellElement>(element);
});
}
}