mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +00:00
LibWeb: Port ProcessingInstruction from ByteString
This commit is contained in:
parent
7ce3e113fa
commit
562e0d710c
4 changed files with 8 additions and 8 deletions
|
@ -1427,7 +1427,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ProcessingInstruction>> Document::create_pr
|
||||||
// FIXME: 2. If data contains the string "?>", then throw an "InvalidCharacterError" DOMException.
|
// FIXME: 2. If data contains the string "?>", then throw an "InvalidCharacterError" DOMException.
|
||||||
|
|
||||||
// 3. Return a new ProcessingInstruction node, with target set to target, data set to data, and node document set to this.
|
// 3. Return a new ProcessingInstruction node, with target set to target, data set to data, and node document set to this.
|
||||||
return heap().allocate<ProcessingInstruction>(realm(), *this, data.to_byte_string(), target.to_byte_string());
|
return heap().allocate<ProcessingInstruction>(realm(), *this, data, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS::NonnullGCPtr<Range> Document::create_range()
|
JS::NonnullGCPtr<Range> Document::create_range()
|
||||||
|
|
|
@ -872,7 +872,7 @@ JS::NonnullGCPtr<Node> Node::clone_node(Document* document, bool clone_children)
|
||||||
auto processing_instruction = verify_cast<ProcessingInstruction>(this);
|
auto processing_instruction = verify_cast<ProcessingInstruction>(this);
|
||||||
|
|
||||||
// Set copy’s target and data to those of node.
|
// Set copy’s target and data to those of node.
|
||||||
auto processing_instruction_copy = heap().allocate<ProcessingInstruction>(realm(), *document, processing_instruction->data().to_byte_string(), processing_instruction->target());
|
auto processing_instruction_copy = heap().allocate<ProcessingInstruction>(realm(), *document, processing_instruction->data(), processing_instruction->target());
|
||||||
copy = processing_instruction_copy;
|
copy = processing_instruction_copy;
|
||||||
}
|
}
|
||||||
// Otherwise, Do nothing.
|
// Otherwise, Do nothing.
|
||||||
|
|
|
@ -13,8 +13,8 @@ namespace Web::DOM {
|
||||||
|
|
||||||
JS_DEFINE_ALLOCATOR(ProcessingInstruction);
|
JS_DEFINE_ALLOCATOR(ProcessingInstruction);
|
||||||
|
|
||||||
ProcessingInstruction::ProcessingInstruction(Document& document, ByteString const& data, ByteString const& target)
|
ProcessingInstruction::ProcessingInstruction(Document& document, String const& data, String const& target)
|
||||||
: CharacterData(document, NodeType::PROCESSING_INSTRUCTION_NODE, MUST(String::from_byte_string(data)))
|
: CharacterData(document, NodeType::PROCESSING_INSTRUCTION_NODE, data)
|
||||||
, m_target(target)
|
, m_target(target)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,16 +17,16 @@ class ProcessingInstruction final : public CharacterData {
|
||||||
public:
|
public:
|
||||||
virtual ~ProcessingInstruction() override = default;
|
virtual ~ProcessingInstruction() override = default;
|
||||||
|
|
||||||
virtual FlyString node_name() const override { return MUST(FlyString::from_deprecated_fly_string(m_target)); }
|
virtual FlyString node_name() const override { return m_target; }
|
||||||
|
|
||||||
ByteString const& target() const { return m_target; }
|
String const& target() const { return m_target; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProcessingInstruction(Document&, ByteString const& data, ByteString const& target);
|
ProcessingInstruction(Document&, String const& data, String const& target);
|
||||||
|
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
|
|
||||||
ByteString m_target;
|
String m_target;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue