mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-05 01:42:54 +00:00
LibWeb: Remove m_src_is_set
field from HTMLScriptElement
Now that we pass an `old_value` parameter to `attribute_changed` it is no longer necessary to store the current attribute state in `HTMLScriptElement`.
This commit is contained in:
parent
a552bda8d9
commit
aa4e18fca5
Notes:
sideshowbarker
2024-07-17 02:37:08 +09:00
Author: https://github.com/tcl3
Commit: aa4e18fca5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/538
2 changed files with 1 additions and 5 deletions
|
@ -59,13 +59,11 @@ void HTMLScriptElement::attribute_changed(FlyString const& name, Optional<String
|
||||||
} else if (name == HTML::AttributeNames::referrerpolicy) {
|
} else if (name == HTML::AttributeNames::referrerpolicy) {
|
||||||
m_referrer_policy = ReferrerPolicy::from_string(value.value_or(""_string)).value_or(ReferrerPolicy::ReferrerPolicy::EmptyString);
|
m_referrer_policy = ReferrerPolicy::from_string(value.value_or(""_string)).value_or(ReferrerPolicy::ReferrerPolicy::EmptyString);
|
||||||
} else if (name == HTML::AttributeNames::src) {
|
} else if (name == HTML::AttributeNames::src) {
|
||||||
bool old_src_is_set = m_src_is_set;
|
|
||||||
m_src_is_set = value.has_value();
|
|
||||||
// https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model
|
// https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model
|
||||||
// When a script element el that is not parser-inserted experiences one of the events listed in the following list, the user agent must immediately prepare the script element el:
|
// When a script element el that is not parser-inserted experiences one of the events listed in the following list, the user agent must immediately prepare the script element el:
|
||||||
// - [...]
|
// - [...]
|
||||||
// - The script element is connected and has a src attribute set where previously the element had no such attribute.
|
// - The script element is connected and has a src attribute set where previously the element had no such attribute.
|
||||||
if (!is_parser_inserted() && is_connected() && !old_src_is_set && m_src_is_set) {
|
if (!is_parser_inserted() && is_connected() && value.has_value() && !old_value.has_value()) {
|
||||||
prepare_script();
|
prepare_script();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,8 +135,6 @@ private:
|
||||||
Optional<DOM::DocumentLoadEventDelayer> m_document_load_event_delayer;
|
Optional<DOM::DocumentLoadEventDelayer> m_document_load_event_delayer;
|
||||||
|
|
||||||
size_t m_source_line_number { 1 };
|
size_t m_source_line_number { 1 };
|
||||||
|
|
||||||
bool m_src_is_set = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue