LibWeb/HTML: Add cloning steps for HTMLScriptElement

This commit is contained in:
Sam Atkins 2025-01-05 15:46:57 +00:00 committed by Tim Ledbetter
commit 3dbaae5cfc
Notes: github-actions[bot] 2025-01-05 21:12:49 +00:00
2 changed files with 14 additions and 0 deletions

View file

@ -650,4 +650,16 @@ void HTMLScriptElement::set_async(bool async)
} }
} }
// https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model:concept-node-clone-ext
WebIDL::ExceptionOr<void> HTMLScriptElement::cloned(Node& copy, bool subtree)
{
TRY(Base::cloned(copy, subtree));
// The cloning steps for script elements given node, copy, and subtree are to set copy's already started to node's already started.
auto& script_copy = verify_cast<HTMLScriptElement>(copy);
script_copy.m_already_started = m_already_started;
return {};
}
} }

View file

@ -63,6 +63,8 @@ public:
[[nodiscard]] bool async() const; [[nodiscard]] bool async() const;
void set_async(bool); void set_async(bool);
virtual WebIDL::ExceptionOr<void> cloned(Node&, bool) override;
private: private:
HTMLScriptElement(DOM::Document&, DOM::QualifiedName); HTMLScriptElement(DOM::Document&, DOM::QualifiedName);