NodeList.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) 2021-2023, Luke Wilde <lukew@serenityos.org>
  3. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibWeb/Bindings/LegacyPlatformObject.h>
  9. namespace Web::DOM {
  10. // https://dom.spec.whatwg.org/#nodelist
  11. class NodeList : public Bindings::LegacyPlatformObject {
  12. WEB_PLATFORM_OBJECT(NodeList, Bindings::LegacyPlatformObject);
  13. public:
  14. virtual ~NodeList() override;
  15. virtual u32 length() const = 0;
  16. virtual Node const* item(u32 index) const = 0;
  17. virtual WebIDL::ExceptionOr<JS::Value> item_value(size_t index) const override;
  18. virtual bool is_supported_property_index(u32) const override;
  19. protected:
  20. explicit NodeList(JS::Realm&);
  21. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  22. // ^Bindings::LegacyPlatformObject
  23. virtual bool supports_indexed_properties() const final override { return true; }
  24. virtual bool supports_named_properties() const final override { return false; }
  25. virtual bool has_indexed_property_setter() const final override { return false; }
  26. virtual bool has_named_property_setter() const final override { return false; }
  27. virtual bool has_named_property_deleter() const final override { return false; }
  28. virtual bool has_legacy_override_built_ins_interface_extended_attribute() const final override { return false; }
  29. virtual bool has_legacy_unenumerable_named_properties_interface_extended_attribute() const final override { return false; }
  30. virtual bool has_global_interface_extended_attribute() const final override { return false; }
  31. virtual bool indexed_property_setter_has_identifier() const final override { return false; }
  32. virtual bool named_property_setter_has_identifier() const final override { return false; }
  33. virtual bool named_property_deleter_has_identifier() const final override { return false; }
  34. };
  35. }