Skip to content

Differentiate between "children change" steps and "children inserted" steps#1460

Open
noamr wants to merge 2 commits intomainfrom
insertion-steps
Open

Differentiate between "children change" steps and "children inserted" steps#1460
noamr wants to merge 2 commits intomainfrom
insertion-steps

Conversation

@noamr
Copy link
Contributor

@noamr noamr commented Mar 18, 2026

See whatwg/html#12279

(See WHATWG Working Mode: Changes for more details.)

noamr added a commit to noamr/html that referenced this pull request Mar 18, 2026
This fixes a regression where script would be run as a result of child removal/mutation.
Together with whatwg/dom#1460

Closes whatwg#12279
@noamr noamr requested review from annevk and domfarolino March 18, 2026 17:22
@shannonbooth
Copy link
Member

shannonbooth commented Mar 18, 2026

Thanks! I have also now made a related WPT MR for the CharacterData mutation case web-platform-tests/wpt#58601 I believe this is also technically changing the normative behaviour of - Chromium and Webkit pass this test, but Gecko does not.

edit: Oops, I meant to comment on the HMTL MR here, but same difference!

@noamr
Copy link
Contributor Author

noamr commented Mar 19, 2026

Thanks! I have also now made a related WPT MR for the CharacterData mutation case web-platform-tests/wpt#58601 I believe this is also technically changing the normative behaviour of - Chromium and Webkit pass this test, but Gecko does not.

edit: Oops, I meant to comment on the HMTL MR here, but same difference!

Thanks! Mind opening a Gecko bug for this? I'll update the PRs to link to it.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an argument to children change in some way? This doesn't seem great though as modifications to text nodes are often insertions too and would be missed by this.

@noamr
Copy link
Contributor Author

noamr commented Mar 19, 2026

Should this be an argument to children change in some way?

That's also an option

This doesn't seem great though as modifications to text nodes are often insertions too and would be missed by this.

I think that's exactly the discrepancy in web-platform-tests/wpt#58601 no?

@annevk
Copy link
Member

annevk commented Mar 19, 2026

I think so, but I'm wondering if we should align with Firefox instead to avoid all these awkward cases just for the script element. (And then forever hope nobody (ab)uses these hooks in a similar manner.) Would also like to hear from @rniwa and @smaug----.

@noamr
Copy link
Contributor Author

noamr commented Mar 20, 2026

I dug up some archeological discussions about this: https://lists.w3.org/Archives/Public/public-whatwg-archive/2011Oct/0289.html. Apparently it was "children changed" before, but the concept of "children changed" wasn't well defined at the time, so this commit made it clearer that it's just an insert as a simplification.

In https://lists.w3.org/Archives/Public/public-whatwg-archive/2012May/0105.html, following the commit, Hixie says that the spec wording was to align with firefox/IE behavior at the time.

@rniwa
Copy link

rniwa commented Mar 20, 2026

It's probably not a common scenario but there could be still compatibility bug / regression if we changed the behavior.

Having said that, we could try changing WebKit's behavior and see if it sticks.

@noamr
Copy link
Contributor Author

noamr commented Mar 20, 2026

It's probably not a common scenario but there could be still compatibility bug / regression if we changed the behavior.

Having said that, we could try changing WebKit's behavior and see if it sticks.

If we align with Firefox the compat issue should be relatively safe no?

Though it's still a subset of children-changed as it excludes removals.

@rniwa
Copy link

rniwa commented Mar 20, 2026

It's probably not a common scenario but there could be still compatibility bug / regression if we changed the behavior.
Having said that, we could try changing WebKit's behavior and see if it sticks.

If we align with Firefox the compat issue should be relatively safe no?

Well, there are quite a bit of iOS specific content out there but we can still try.

@shannonbooth
Copy link
Member

I can switch the WPT test case over if that direction is preferred. I suppose in that case DOM standard will need to be adjusted so that all of inserted/removed/mutated children change hooks are exposed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants