Skip to content
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

Fix content removal on css inline cleanup #65

Merged
merged 4 commits into from
Feb 5, 2024

Conversation

marconn
Copy link
Contributor

@marconn marconn commented Feb 5, 2024

  • Regex '/(\s)+class="(.*)"(\s)+/U' will always expect a class attribute to contain an space
    at the end of the attribute, which is not always the case.

  • The regex '/(\s)+class="(.*)(\s)*"/U' will match the class attribute even if it is the last
    attribute of the tag.

Repro: https://www.phpliveregex.com/p/KWH
With fix: https://www.phpliveregex.com/p/KXi

- Regex `'/(\s)+class="(.*)"(\s)+/U'` will always
expect a class attribute to contain an space
at the end of the attribute, which is not always
the case.

- The regex `'/(\s)+class="(.*)"/U'` will match
the class attribute even if it is the last
attribute of the tag.

Repro: https://www.phpliveregex.com/p/KWH
With fix: https://www.phpliveregex.com/p/KXi
library/Kima/Html/CssToInline.php Outdated Show resolved Hide resolved
Copy link
Collaborator

@kenntchan kenntchan left a comment

Choose a reason for hiding this comment

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

.

@kenntchan kenntchan merged commit 64433a7 into stevevega:master Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants