diff --git a/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index da90594c34..0d2efc90cb 100644 --- a/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -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 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(copy); + script_copy.m_already_started = m_already_started; + + return {}; +} + } diff --git a/Libraries/LibWeb/HTML/HTMLScriptElement.h b/Libraries/LibWeb/HTML/HTMLScriptElement.h index 44e0f305c2..6e49fe7cab 100644 --- a/Libraries/LibWeb/HTML/HTMLScriptElement.h +++ b/Libraries/LibWeb/HTML/HTMLScriptElement.h @@ -63,6 +63,8 @@ public: [[nodiscard]] bool async() const; void set_async(bool); + virtual WebIDL::ExceptionOr cloned(Node&, bool) override; + private: HTMLScriptElement(DOM::Document&, DOM::QualifiedName);