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

Add prefix to SVG id/class attributes (#16997) #17000

Merged
merged 2 commits into from
Sep 9, 2021

Commits on Sep 9, 2021

  1. Use filename as id/class prefix. (go-gitea#16997)

    Currently the svg minifier (`make svg`) rewrites all `id` and `class` attributes in svg files. Every file gets the ids `a, b, ...`. If multiple svgs with ids are used on a page these ids are conflicting and the results are broken images.
    
    | minified ids | unique ids |
    | - | - |
    | ![grafik](https://user-images.githubusercontent.com/1666336/132579375-59d3996f-c4e5-43b8-8c8d-82280c90d9e3.png) | ![grafik](https://user-images.githubusercontent.com/1666336/132579413-05bf9285-4e3b-4d0d-8f95-90b212405b05.png) |
    
    This PR adds a prefix (the filename) to every id/class.
    
    Follow up problem: Because we embed svg images there are duplicated ids if one svg image is used multiple times on a page. As those ids refer to the same content it may be no real problem because browser handle that fine.
    KN4CK3R committed Sep 9, 2021
    Configuration menu
    Copy the full SHA
    f5bf46e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    351b003 View commit details
    Browse the repository at this point in the history