mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-19 02:10:26 +00:00
LibWeb/HTML: Do not run script on child removal
Matching the behaviour of the other big three browser engines, also tested by WPT, but does not appear to be explicitly specified. I also noticed when investigating that browser engines disagree about whether a child mutation should trigger script execution. For this, I've just gone with the behaviour of Webkit/Chromium of not running script.
This commit is contained in:
parent
cc6536b527
commit
27436c3971
Notes:
github-actions[bot]
2026-03-19 08:47:52 +00:00
Author: https://github.com/shannonbooth
Commit: 27436c3971
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8486
Reviewed-by: https://github.com/gmta ✅
4 changed files with 53 additions and 0 deletions
|
|
@ -652,6 +652,12 @@ void HTMLScriptElement::children_changed(ChildrenChangedMetadata const& metadata
|
|||
{
|
||||
Base::children_changed(metadata);
|
||||
|
||||
// AD-HOC: Avoid running script on child removal, matching the behaviour of other browsers.
|
||||
// We also do not run script on child mutation, matching the behaviour of chromium and webkit.
|
||||
// See: https://github.com/whatwg/html/issues/12279
|
||||
if (metadata.type != ChildrenChangedMetadata::Type::Inserted)
|
||||
return;
|
||||
|
||||
// 1. If the script element is not connected, then return.
|
||||
if (!is_connected())
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue