ProcessingInstruction.h 908 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2021, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/DeprecatedFlyString.h>
  8. #include <LibWeb/DOM/CharacterData.h>
  9. namespace Web::DOM {
  10. class ProcessingInstruction final : public CharacterData {
  11. WEB_PLATFORM_OBJECT(ProcessingInstruction, CharacterData);
  12. public:
  13. virtual ~ProcessingInstruction() override = default;
  14. virtual DeprecatedFlyString node_name() const override { return m_target; }
  15. DeprecatedString const& target() const { return m_target; }
  16. private:
  17. ProcessingInstruction(Document&, DeprecatedString const& data, DeprecatedString const& target);
  18. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  19. DeprecatedString m_target;
  20. };
  21. template<>
  22. inline bool Node::fast_is<ProcessingInstruction>() const { return node_type() == (u16)NodeType::PROCESSING_INSTRUCTION_NODE; }
  23. }