-
Notifications
You must be signed in to change notification settings - Fork 144
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 ability to rewrite clipPath url() relative fragment id links in the SVG so they work properly when the <base> tag is being used #16
Comments
The solution I proposed in my post on the community (I am Jérôme P.) doesn't work when using a url containing a reference to an id on the page (ex: mysite.com#about) since window.location.href includes the part after the '#'. A possible solution to this would be to remove everything after the '#' by doing something like: |
This is a pretty big issue with Angular 1.3 as 1.3 now requires the base tag with HTML5 mode enabled (and I assume most people enabled this). |
one could detect if var absoluteAttr = relativeAttr.replace(/(url\(\s*)#/, '$1' + window.location + '#') |
This is also an issue when using Ember with ember-cli, which also requires a |
@fdanielsen I'm trying to do this in an ember-cli app as well. Did you by chance find a solution? |
Sorry, @JackCA, my solution in ember-cli was simply to remove the usage of the |
Here's some additional reference for this issue, including mention of the new feature to opt-out of using the
|
I have found a solution that works in my sites (I found this somewhere else). This does also work on pages with a reference to an ID (#) :-) iconic.js - line 1030: referencingElements[j].setAttribute(property, "url("+ window.location.href.replace(/#.*/, "") + "#" + newId + ")") |
When using SVG
clipPath
elements, which are referenced and used via theurl(#clip-path-id)
syntax, adding the<base>
tag to the page changes the meaning/location of that relative identifier fragment so the clipPaths can't be found (causing the SVG to not render as expected).Using the
<base>
tag can also cause issues with SVG gradients, masks, markers, etc… which are also referenced by relative fragment id.References:
https://useiconic.com/community#!/tools:icons-not-displaying-correc
http://stackoverflow.com/questions/24673855/svg-clip-path-working-locally-but-not-online
The text was updated successfully, but these errors were encountered: