Skip to content

Commit

Permalink
Merge pull request svg#741 from davidtheclark/aria-attributes
Browse files Browse the repository at this point in the history
Add keepAriaAttrs to removeUnknownsAndDefaults
  • Loading branch information
GreLI authored Jun 13, 2017
2 parents c943b4c + 5c1aab8 commit 718d576
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 718d576

Please sign in to comment.