You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In addition, regexp are used to strip or replace attributes and their values: a safer approach (proposed in the linked PR) would be to use an instance of DOMParser.
Proposed solution
The PR for this fix removes width and height attributes only from the root element.
Usage of DOMParser where possible (as mentioned)
The text was updated successfully, but these errors were encountered:
Good point. That regexp is too generic, indeed. The idea was just to strip out the ones on the initial svg tag so that you can essentially adjust the viewport of the SVG via CSS if needed (i.e. to align several icon sizes on a page when the original icons have different sizes)
Expected Behaviour
SVG images, including vector logos, displaying correctly all the elements (e.g. rects)
Actual Behaviour
some SVG images are shown with missing rects or polygons
Root cause (identified)
The following lines are stripping width and height attributes from all the vector elements in a svg element:
https://github.com/adobe/helix-project-boilerplate/blob/main/scripts/lib-franklin.js#LL161-L162
In addition, regexp are used to strip or replace attributes and their values: a safer approach (proposed in the linked PR) would be to use an instance of
DOMParser
.Proposed solution
The text was updated successfully, but these errors were encountered: