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
Call this library as svg('file.svg', ['id='b']) or as a component <x-icon-a id="b"/>
The result will be an invalid html element:
<svgid="a"id="b"></svg>
Expected behaviour would be:
<svgid="b"></svg>
How to solve it
The problem lies in https://github.com/blade-ui-kit/blade-icons/blob/1.x/src/Svg.php#L37 file, where each generated attribute is appended instead of replaced. As a solution, svg tag should be parsed with DOMDocument or SimpleXMLElement and attributes should be replaced as needed. Already tried this though and these libraries does not work with xmlns="" attribute and this attribute is always ignored. So we might consider dropping this attribute if we want to go this path.
The text was updated successfully, but these errors were encountered:
Library version
v1.3.1
Laravel version
9.x
PHP version
8.1
Description
Library does not overwrite svg attributes. It's a big deal then using libraries such bootstrap icons as all icons already have class attribute and it's impossible to overwrite it. Example:
https://github.com/twbs/icons/blob/main/icons/1-square-fill.svg?short_path=de579e6
Steps to reproduce
Take this svg file for example:
Call this library as
svg('file.svg', ['id='b'])
or as a component<x-icon-a id="b"/>
The result will be an invalid html element:
Expected behaviour would be:
How to solve it
The problem lies in https://github.com/blade-ui-kit/blade-icons/blob/1.x/src/Svg.php#L37 file, where each generated attribute is appended instead of replaced. As a solution, svg tag should be parsed with DOMDocument or SimpleXMLElement and attributes should be replaced as needed. Already tried this though and these libraries does not work with
xmlns=""
attribute and this attribute is always ignored. So we might consider dropping this attribute if we want to go this path.The text was updated successfully, but these errors were encountered: