Skip to content

Commit

Permalink
Add keepAriaAttrs to removeUnknownsAndDefaults
Browse files Browse the repository at this point in the history
Closes svg#684.
  • Loading branch information
David Clark committed Jun 13, 2017
1 parent c943b4c commit 5c1aab8
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/removeUnknownsAndDefaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ exports.params = {
unknownAttrs: true,
defaultAttrs: true,
uselessOverrides: true,
keepDataAttrs: true
keepDataAttrs: true,
keepAriaAttrs: true
};

var collections = require('./_collections'),
Expand Down Expand Up @@ -105,7 +106,8 @@ exports.fn = function(item, params) {
if (
attr.name !== 'xmlns' &&
(attr.prefix === 'xml' || !attr.prefix) &&
(!params.keepDataAttrs || attr.name.indexOf('data-') != 0)
(!params.keepDataAttrs || attr.name.indexOf('data-') != 0) &&
(!params.keepAriaAttrs || attr.name.indexOf('aria-') != 0)
) {
if (
// unknown attrs
Expand Down
19 changes: 19 additions & 0 deletions test/plugins/removeUnknownsAndDefaults.11.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions test/plugins/removeUnknownsAndDefaults.12.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 5c1aab8

Please sign in to comment.