LibWeb: Include a comment for media src attribute and match spec

We're apparently not supposed to load anything when the attribute is
removed.
This commit is contained in:
Zaggy1024
2026-03-25 20:12:44 -05:00
committed by Gregory Bertilson
parent 978ca691c8
commit a41e1ad080
Notes: github-actions[bot] 2026-04-01 07:56:38 +00:00

View File

@@ -159,6 +159,12 @@ void HTMLMediaElement::attribute_changed(FlyString const& name, Optional<String>
Base::attribute_changed(name, old_value, value, namespace_);
if (name == HTML::AttributeNames::src) {
// https://html.spec.whatwg.org/multipage/media.html#attr-media-src
// If a src attribute of a media element is set or changed, the user agent must invoke the
// media element's media element load algorithm. (Removing the src attribute does not do
// this, even if there are source elements present.)
if (!value.has_value())
return;
load_element().release_value_but_fixme_should_propagate_errors();
} else if (name == HTML::AttributeNames::crossorigin) {
m_crossorigin = cors_setting_attribute_from_keyword(value);