mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Set script force async to false when async changes
This commit is contained in:
parent
77c41a82be
commit
bedb626c29
Notes:
github-actions[bot]
2024-08-04 18:26:23 +00:00
Author: https://github.com/jamierocks
Commit: bedb626c29
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/961
Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 9 additions and 0 deletions
|
@ -1,2 +1,3 @@
|
||||||
includeScript.async = false
|
includeScript.async = false
|
||||||
script.async = true
|
script.async = true
|
||||||
|
script.async = false
|
||||||
|
|
|
@ -7,5 +7,9 @@
|
||||||
|
|
||||||
const script = document.createElement("script");
|
const script = document.createElement("script");
|
||||||
println(`script.async = ${script.async}`);
|
println(`script.async = ${script.async}`);
|
||||||
|
|
||||||
|
script.setAttribute("async", "true");
|
||||||
|
script.removeAttribute("async");
|
||||||
|
println(`script.async = ${script.async}`);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -66,6 +66,10 @@ void HTMLScriptElement::attribute_changed(FlyString const& name, Optional<String
|
||||||
if (!is_parser_inserted() && is_connected() && value.has_value() && !old_value.has_value()) {
|
if (!is_parser_inserted() && is_connected() && value.has_value() && !old_value.has_value()) {
|
||||||
prepare_script();
|
prepare_script();
|
||||||
}
|
}
|
||||||
|
} else if (name == HTML::AttributeNames::async) {
|
||||||
|
// https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model:script-force-async
|
||||||
|
// When an async attribute is added to a script element el, the user agent must set el's force async to false.
|
||||||
|
m_force_async = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue