Skip to content

Conversation

@lucaswerkmeister
Copy link
Member

No description provided.

Some of these are technically slight behavior changes, but not
significant ones IMHO.
If we manipulate the DOM while iterating over it, the iteration may skip
elements. At the moment the library uses two different workarounds for
this: iterate over a shallow copy of the list using iterator_to_array()
(handleNode(), handleAttributeBinding()), or defer the manipulation
until after the loop (handleIf()). stripEventHandlers() did neither and
therefore failed to remove consecutive event handlers; fix that using
the defer approach, as I think that’s slightly more efficient in this
case. Also use removeAttributeNode() while we’re at it so that PHP
doesn’t have to look up the attribute by its name again.
Copy link
Contributor

@codders codders left a comment

Choose a reason for hiding this comment

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

Looks good - let's do it!

@codders codders merged commit 1255b0f into master Jun 12, 2025
8 checks passed
@codders codders deleted the cleanup branch June 12, 2025 08:35
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.

3 participants