Merge pull request #34 from adroitwhiz/skip-numeric-id-import

Don't set item names in SVG import
This commit is contained in:
adroitwhiz 2020-07-09 17:25:10 -04:00 committed by GitHub
commit 155b58fa25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -445,8 +445,6 @@ new function() {
}, {}), { }, {}), {
id: function(item, value) { id: function(item, value) {
definitions[value] = item; definitions[value] = item;
if (item.setName)
item.setName(value);
}, },
'clip-path': function(item, value) { 'clip-path': function(item, value) {

View file

@ -168,6 +168,16 @@ test('Import SVG string with leading line-breaks', function() {
})); }));
}); });
test('Import SVG with numeric ID', function() {
paper.project.importSVG(createSVG('circle', {
cx: 100,
cy: 100,
r: 50,
id: '1'
}));
ok(true, 'Imports SVG with a numeric element ID without throwing.');
});
function importSVG(assert, url, message, options) { function importSVG(assert, url, message, options) {
var done = assert.async(); var done = assert.async();
project.importSVG(url, { project.importSVG(url, {