2021-10-02 20:33:45 +01:00
|
|
|
/*
|
2023-02-28 00:05:39 +00:00
|
|
|
* Copyright (c) 2021-2023, Luke Wilde <lukew@serenityos.org>
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
2021-10-02 20:33:45 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-01-09 16:05:03 -07:00
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
2021-10-02 20:33:45 +01:00
|
|
|
|
|
|
|
namespace Web::DOM {
|
|
|
|
|
|
|
|
// https://dom.spec.whatwg.org/#nodelist
|
2024-01-09 16:05:03 -07:00
|
|
|
class NodeList : public Bindings::PlatformObject {
|
|
|
|
WEB_PLATFORM_OBJECT(NodeList, Bindings::PlatformObject);
|
2021-10-02 20:33:45 +01:00
|
|
|
|
|
|
|
public:
|
2022-09-01 16:30:26 +02:00
|
|
|
virtual ~NodeList() override;
|
2021-10-02 20:33:45 +01:00
|
|
|
|
|
|
|
virtual u32 length() const = 0;
|
|
|
|
virtual Node const* item(u32 index) const = 0;
|
|
|
|
|
2024-07-25 18:15:51 +12:00
|
|
|
virtual Optional<JS::Value> item_value(size_t index) const override;
|
2021-10-02 20:33:45 +01:00
|
|
|
|
|
|
|
protected:
|
2022-09-25 16:15:49 -06:00
|
|
|
explicit NodeList(JS::Realm&);
|
2023-01-10 06:56:59 -05:00
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2021-10-02 20:33:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|