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

Closes #34: exclude svg use from lrc #37

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Miraeld
Copy link

@Miraeld Miraeld commented Oct 9, 2024

Description

Fixes #34

We are adding a _getSvgUseTargets function to BeaconLrc so we can detect svg use and avoid processing them.

Type of change

  • Bug fix (non-breaking change which fixes an issue).

Detailed scenario

Refer to wp-media/wp-rocket#6978

Technical description

Documentation

Purpose: The method gathers all parent elements of elements in the document. This is useful for operations that need to affect or be aware of the entire SVG hierarchy.
Implementation:
It first selects all elements in the document.
For each element, it traverses up the DOM tree, collecting each parent element until it reaches the .
It uses a Set to ensure that each parent element is collected only once.
Finally, it returns an array of these parent elements.

New dependencies

None

Risks

None

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

@Miraeld Miraeld self-assigned this Oct 9, 2024
@Miraeld Miraeld added the bug Something isn't working label Oct 9, 2024
Copy link

codacy-production bot commented Oct 9, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+1.46% (target: -1.00%) 100.00% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (261e1f8) 635 400 62.99%
Head commit (17905b5) 661 (+26) 426 (+26) 64.45% (+1.46%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#37) 27 27 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

@Khadreal Khadreal requested a review from a team October 10, 2024 10:07
Khadreal
Khadreal previously approved these changes Oct 10, 2024
@jeawhanlee
Copy link
Contributor

Test coverage here is below 50%, it would make sense if we could have higher test coverage here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exclude svg use targets from LRC - Rocket-scripts
3 participants