1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:07:45 +00:00

LibWeb: Implement basic support for Document.all

The finer details are missing here, but the basic API is up.
This commit is contained in:
Andreas Kling 2022-09-18 02:17:11 +02:00
parent 3df9861814
commit e6ef366859
3 changed files with 17 additions and 0 deletions

View file

@ -323,6 +323,7 @@ void Document::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_links);
visitor.visit(m_forms);
visitor.visit(m_scripts);
visitor.visit(m_all);
for (auto& script : m_scripts_to_execute_when_parsing_has_finished)
visitor.visit(script.ptr());
@ -1041,6 +1042,17 @@ JS::NonnullGCPtr<HTMLCollection> Document::scripts()
return *m_scripts;
}
// https://html.spec.whatwg.org/multipage/dom.html#dom-document-all
JS::NonnullGCPtr<HTMLCollection> Document::all()
{
if (!m_all) {
m_all = HTMLCollection::create(*this, [](Element const&) {
return true;
});
}
return *m_all;
}
Color Document::link_color() const
{
if (m_link_color.has_value())