Skip to content

Commit

Permalink
Use first item of few with same ID (as browsers do). Remove subsequen…
Browse files Browse the repository at this point in the history
…t IDs. Resolves svg#378
  • Loading branch information
GreLI committed Jun 21, 2015
1 parent 20e2a30 commit 2c2f9e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/cleanupIDs.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ exports.fn = function(data, params) {
item.eachAttr(function(attr) {
// save IDs
if (attr.name === 'id') {
IDs[idPrefix + attr.value] = item;
if (idPrefix + attr.value in IDs) {
item.removeAttr('id');
} else {
IDs[idPrefix + attr.value] = item;
}
}

// save IDs url() references
Expand Down
6 changes: 6 additions & 0 deletions test/plugins/cleanupIDs.01.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2c2f9e7

Please sign in to comment.