Lattyware / elm-fontawesome

FontAwesome for Elm.
https://package.elm-lang.org/packages/lattyware/elm-fontawesome/latest/
MIT License
33 stars 6 forks source link

Masking ID generation. #1

Closed Lattyware closed 5 years ago

Lattyware commented 5 years ago

Currently, we can generate invalid output in specific situations: When masks are created, the official library generates random IDs to avoid collisions from multiple icons on the same page. In Elm, this would be a real pain to do (you would have to provide randomness and distribute it among icons you use). We instead use fixed IDs based on the icon names. This will produce incorrect output (multiple nodes with the same ID) in some cases. That said, all browsers I've tested seem to handle this case fine, and it is only an issue if you reuse the same icon in a mask with different transforms in the same page (otherwise as the name of the icon is used to differentiate, the only collision will be between duplicated elements in defs, which are would be exactly the same unless a different transform is used.)

While I believe this is a reasonable trade-off that won't affect most people, if there is demand for it, another interface that allows the user to pass in IDs (probably with a convenience utility to do this using a randomness seed that is passed around) is possible and would fix the issue.

Lattyware commented 5 years ago

This got fixed as of b35e78164489b306d13818747a3a1ede9e4560a7.