Comments (7)
I'll leave the script I've used to generate unique ids here in case lipis/flag-icons will not be interested in PR.
<?php
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(
'svg',
FilesystemIterator::SKIP_DOTS
)
);
$rules = [
'/ id="([a-z])"/' => ' id="{CODE}-$1"',
'/ xlink:href="#([a-z])"/' => ' xlink:href="#{CODE}-$1"',
'/"url\(#([a-z])\)"/' => '"url(#{CODE}-$1)"',
];
foreach ($files as $file) {
$code = $file->getBasename('.svg');
$fileObj = $file->openFile('r+');
$contents = $fileObj->fread($file->getSize());
$compiledRules = [];
foreach ($rules as $key => $value) {
$compiledRules[$key] = str_replace('{CODE}', $code, $value);
}
$contents = preg_replace(
array_keys($compiledRules),
array_values($compiledRules),
$contents
);
$fileObj->rewind();
$fileObj->fwrite($contents);
}
from flags.
Just tagged the new release with updated icons. Try to update, maybe new icons will fix the issue.
from flags.
Nope, problem remains after updating to v1.0.6
, unfortunately.
Cameroon's flag normally:
Cameroon's flag after changing sort order of the table:
Hovering over the <g fill="#fcd116" [...]>
element when flag is as intended:
Hovering over the <g fill="#fcd116" [...]>
element when flag is in broken state:
from flags.
I was able to reproduce similar issue at codepen. Looks like an issue caused by duplicated ids in these flags.
Codepen with sortable table: https://codepen.io/vovayatsyuk/pen/eYrPXgW?editors=1000
- At the initial page load, the Honduras flag is corrupted.
- When changing sort order by clicking on the table header Cameroon and Indian flags get corrupted.
from flags.
I've updated codepen with additional table where I've added -COUNTRY_CODE
suffix to all ids.
Here is a result:
@lipis have you ever noticed such behaviour?
from flags.
Good catch, I totally missed that one, but it makes a lot of sense in the context.
from flags.
I've just tagged the new release. The issue should be fixed now.
from flags.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flags.