-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix basetag bug #664
Fix basetag bug #664
Conversation
the prefix is removed on export and added on import
I thought about that, too. But when some genius people start creating the basetag with javascript we are lost again. But one might argue that this is the users fault then because he should know better. |
True. This solution covers all use cases. I think it's good to go then. We might be missing some attributes using an URL, but that's something for later. |
Atm every attribute which matches |
But I guess thats not enough. |
src/regex.js
Outdated
@@ -39,6 +39,9 @@ SVG.regex = { | |||
// Test for image url | |||
, isImage: /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i | |||
|
|||
// Test for url reference | |||
, isUrl: /url\(([-\w:/]+(?:\.\w+)?)?#([-\w]+)\)/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there might be some cases that this regexp is not matching, like url(https://example.org/absolute/URI/with/absolute/path/to/resource.txt#theid)
. Also, I was wondering if we could use a simpler regexp instead, something like this: /url\((.*)#([-\w]+)\)/
. We keep it simple and just check if there is something in front of the id. If there is nothing, then we had the complete url. I don't know if it is worth it to try to detect if the path before the id is absolute or relative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like to be loose as possible by avoing the .*
operator. I will go for /(url\()?([-\w:/.]+)?#([-\w]+)/
which should match everything valid.
Seriously I dont like this... |
Absolutely agree. Let's poor it into a plugin. |
I 100% agree! |
prefix all
url()
references with current location (#568)the prefix is removed on export and added on import.
TODO:
fill="url(google.de/some.svg# someId)"
and the same when importing