Skip to content

Commit

Permalink
LibWeb: Remove m_src_is_set field from HTMLScriptElement
Browse files Browse the repository at this point in the history
Now that we pass an `old_value` parameter to `attribute_changed` it is
no longer necessary to store the current attribute state in
`HTMLScriptElement`.
  • Loading branch information
tcl3 committed Jul 9, 2024
1 parent b09e6e9 commit ef79148
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 1 addition & 3 deletions Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,11 @@ void HTMLScriptElement::attribute_changed(FlyString const& name, Optional<String
} else if (name == HTML::AttributeNames::referrerpolicy) {
m_referrer_policy = ReferrerPolicy::from_string(value.value_or(""_string)).value_or(ReferrerPolicy::ReferrerPolicy::EmptyString);
} 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
// 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.
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();
}
}
Expand Down
2 changes: 0 additions & 2 deletions Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ class HTMLScriptElement final : public HTMLElement {
Optional<DOM::DocumentLoadEventDelayer> m_document_load_event_delayer;

size_t m_source_line_number { 1 };

bool m_src_is_set = false;
};

}
Expand Down

0 comments on commit ef79148

Please sign in to comment.