
These classes only needed Window to get at its realm. Pass a realm directly to construct DOM and WebIDL classes. This change importantly removes the guarantee that a Document will always have a non-null Window object. Only Documents created by a BrowsingContext will have a non-null Window object. Documents created by for example, DocumentFragment, will not have a Window (soon). This incremental commit leaves some workarounds in place to keep other parts of the code building.
31 lines
735 B
C++
31 lines
735 B
C++
/*
|
|
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Bindings/LegacyPlatformObject.h>
|
|
|
|
namespace Web::DOM {
|
|
|
|
// https://dom.spec.whatwg.org/#nodelist
|
|
class NodeList : public Bindings::LegacyPlatformObject {
|
|
WEB_PLATFORM_OBJECT(NodeList, Bindings::LegacyPlatformObject);
|
|
|
|
public:
|
|
virtual ~NodeList() override;
|
|
|
|
virtual u32 length() const = 0;
|
|
virtual Node const* item(u32 index) const = 0;
|
|
|
|
virtual JS::Value item_value(size_t index) const override;
|
|
virtual bool is_supported_property_index(u32) const override;
|
|
|
|
protected:
|
|
explicit NodeList(JS::Realm&);
|
|
};
|
|
|
|
}
|