1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

LibWeb: Add simple implementation of Document.createElementNS

This commit is contained in:
Luke 2021-01-28 20:15:04 +00:00 committed by Andreas Kling
parent affb4ef01b
commit 449c6c5604
4 changed files with 14 additions and 3 deletions

View file

@ -566,12 +566,21 @@ JS::Value Document::run_javascript(const StringView& source)
return result;
}
// https://dom.spec.whatwg.org/#dom-document-createelement
// FIXME: This only implements step 6 of the algorithm and does not take in options.
NonnullRefPtr<Element> Document::create_element(const String& tag_name)
{
// FIXME: Let namespace be the HTML namespace, if this is an HTML document or thiss content type is "application/xhtml+xml", and null otherwise.
return DOM::create_element(*this, tag_name, Namespace::HTML);
}
// https://dom.spec.whatwg.org/#internal-createelementns-steps
// FIXME: This only implements step 4 of the algorithm and does not take in options.
NonnullRefPtr<Element> Document::create_element_ns(const String& namespace_, const String& qualified_name)
{
return DOM::create_element(*this, qualified_name, namespace_);
}
NonnullRefPtr<DocumentFragment> Document::create_document_fragment()
{
return adopt(*new DocumentFragment(*this));