Skip to content

Commit

Permalink
LibWeb/HTML: Add cloning steps for HTMLScriptElement
Browse files Browse the repository at this point in the history
  • Loading branch information
AtkinsSJ authored and tcl3 committed Jan 5, 2025
1 parent 2e96ba1 commit 3dbaae5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Libraries/LibWeb/HTML/HTMLScriptElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
}

}
2 changes: 2 additions & 0 deletions Libraries/LibWeb/HTML/HTMLScriptElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class HTMLScriptElement final : public HTMLElement {
[[nodiscard]] bool async() const;
void set_async(bool);

virtual WebIDL::ExceptionOr<void> cloned(Node&, bool) override;

private:
HTMLScriptElement(DOM::Document&, DOM::QualifiedName);

Expand Down

0 comments on commit 3dbaae5

Please sign in to comment.