Skip to content

Two minor cleanups #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2025
Merged

Two minor cleanups #34

merged 2 commits into from
Jun 12, 2025

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.

2 participants