LibWeb/HTML: Update cloning steps to current spec algorithms

Reflects the changes in https://github.com/whatwg/html/pull/10859

I've also added missing calls to the Base::cloned() method, and modified
a couple of spec links to point to the multipage version.

I took the liberty to fix a spec typo, and submitted a PR for it:
https://github.com/whatwg/html/pull/10892
This commit is contained in:
Sam Atkins 2025-01-05 15:46:37 +00:00 committed by Tim Ledbetter
parent 172d5f6987
commit 2e96ba11e4
Notes: github-actions[bot] 2025-01-05 21:12:56 +00:00
4 changed files with 26 additions and 18 deletions

View file

@ -56,7 +56,7 @@ void HTMLOrSVGElement<ElementBase>::blur()
// User agents may selectively or uniformly ignore calls to this method for usability reasons.
}
// https://html.spec.whatwg.org/#dom-noncedelement-nonce
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#dom-noncedelement-nonce
template<typename ElementBase>
void HTMLOrSVGElement<ElementBase>::attribute_changed(FlyString const& local_name, Optional<String> const&, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
@ -76,17 +76,17 @@ void HTMLOrSVGElement<ElementBase>::attribute_changed(FlyString const& local_nam
}
}
// https://html.spec.whatwg.org/#dom-noncedelement-nonce
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#dom-noncedelement-nonce
template<typename ElementBase>
WebIDL::ExceptionOr<void> HTMLOrSVGElement<ElementBase>::cloned(DOM::Node& copy, bool)
{
// The cloning steps for elements that include HTMLOrSVGElement must set the
// [[CryptographicNonce]] slot on the copy to the value of the slot on the element being cloned.
// The cloning steps for elements that include HTMLOrSVGElement given node, copy, and subtree
// are to set copy's [[CryptographicNonce]] to node's [[CryptographicNonce]].
static_cast<ElementBase&>(copy).m_cryptographic_nonce = m_cryptographic_nonce;
return {};
}
// https://html.spec.whatwg.org/#dom-noncedelement-nonce
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#dom-noncedelement-nonce
template<typename ElementBase>
void HTMLOrSVGElement<ElementBase>::inserted()
{