mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
LibWeb: Add Document.createProcessingInstruction()
These nodes don't really do anything interesting yet, but let's allow creating them. :^)
This commit is contained in:
parent
bf759ce5e3
commit
8b0ace6289
3 changed files with 17 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
|||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/HTMLCollection.h>
|
||||
#include <LibWeb/DOM/NodeIterator.h>
|
||||
#include <LibWeb/DOM/ProcessingInstruction.h>
|
||||
#include <LibWeb/DOM/Range.h>
|
||||
#include <LibWeb/DOM/ShadowRoot.h>
|
||||
#include <LibWeb/DOM/Text.h>
|
||||
|
@ -1233,6 +1234,17 @@ JS::NonnullGCPtr<Comment> Document::create_comment(DeprecatedString const& data)
|
|||
return *heap().allocate<Comment>(realm(), *this, data);
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<ProcessingInstruction>> Document::create_processing_instruction(DeprecatedString const& target, DeprecatedString const& data)
|
||||
{
|
||||
// FIXME: 1. If target does not match the Name production, 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.
|
||||
return JS::NonnullGCPtr { *heap().allocate<ProcessingInstruction>(realm(), *this, data, target) };
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<Range> Document::create_range()
|
||||
{
|
||||
return Range::create(*this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue