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

refactor: create hasScripts util #1809

Merged
merged 1 commit into from Oct 22, 2023

Conversation

SethFalco
Copy link
Member

@SethFalco SethFalco commented Oct 13, 2023

I'd like for SVGO to have more utilities, so we can have more consistent behavior between plugins and simplify the plugins themselves.

One clear pick was determining if a node contained scripts, which was done differently across several plugins. This creates a utility that takes from existing checks, and adds more.

A node that meets one of the following conditions is treated as one that contains scripts:

  • If there is a <script> tag that contains text.
  • If there is a <a> tag with a JavaScript URI.
  • If there is an event attribute.

Related

@SethFalco SethFalco merged commit 3966c10 into svg:main Oct 22, 2023
5 checks passed
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.

None yet

1 participant