From 7fd48e9d206c34e58066c932f411150f95c5e32d Mon Sep 17 00:00:00 2001 From: Eli Dupuis Date: Sat, 16 Jul 2016 11:16:38 -0700 Subject: [PATCH] Rename plugin to `removeElementsByAttr` --- ...oveElements.js => removeElementsByAttr.js} | 19 ++++++++++--------- ...nts.01.svg => removeElementsByAttr.01.svg} | 2 +- ...nts.02.svg => removeElementsByAttr.02.svg} | 2 +- ...nts.03.svg => removeElementsByAttr.03.svg} | 0 4 files changed, 12 insertions(+), 11 deletions(-) rename plugins/{removeElements.js => removeElementsByAttr.js} (75%) rename test/plugins/{removeElements.01.svg => removeElementsByAttr.01.svg} (96%) rename test/plugins/{removeElements.02.svg => removeElementsByAttr.02.svg} (92%) rename test/plugins/{removeElements.03.svg => removeElementsByAttr.03.svg} (100%) diff --git a/plugins/removeElements.js b/plugins/removeElementsByAttr.js similarity index 75% rename from plugins/removeElements.js rename to plugins/removeElementsByAttr.js index 6fbab9c1..1dda1e34 100644 --- a/plugins/removeElements.js +++ b/plugins/removeElementsByAttr.js @@ -7,24 +7,25 @@ exports.active = false; exports.description = 'removes arbitrary elements by ID (disabled by default)'; exports.params = { - ids: [] + id: [], + class: [] }; /** * Remove SVG elements by ID. * - * @param ids + * @param id * examples: * * > single: remove element with ID of `elementID` * --- - * removeElements: - * ids: 'elementID' + * removeElementsByAttr: + * id: 'elementID' * * > list: remove multiple elements by ID * --- - * removeElements: - * ids: + * removeElementsByAttr: + * id: * - 'elementID' * - 'anotherID' * @@ -38,8 +39,8 @@ exports.fn = function(item, params) { var elemId; // wrap into an array if params is not - if (!Array.isArray(params.ids)) { - params.ids = [params.ids]; + if (!Array.isArray(params.id)) { + params.id = [params.id]; } if (!item.isElem()) { @@ -48,6 +49,6 @@ exports.fn = function(item, params) { elemId = item.attr('id'); if (elemId) { - return params.ids.indexOf(elemId.value) === -1; + return params.id.indexOf(elemId.value) === -1; } }; diff --git a/test/plugins/removeElements.01.svg b/test/plugins/removeElementsByAttr.01.svg similarity index 96% rename from test/plugins/removeElements.01.svg rename to test/plugins/removeElementsByAttr.01.svg index e9139e5f..966f4aa0 100644 --- a/test/plugins/removeElements.01.svg +++ b/test/plugins/removeElementsByAttr.01.svg @@ -11,4 +11,4 @@ @@@ -{ "ids": "someID" } +{ "id": "someID" } diff --git a/test/plugins/removeElements.02.svg b/test/plugins/removeElementsByAttr.02.svg similarity index 92% rename from test/plugins/removeElements.02.svg rename to test/plugins/removeElementsByAttr.02.svg index 79c09fe0..aa15fc9e 100644 --- a/test/plugins/removeElements.02.svg +++ b/test/plugins/removeElementsByAttr.02.svg @@ -9,4 +9,4 @@ @@@ -{ "ids": ["someID", "anotherID"] } +{ "id": ["someID", "anotherID"] } diff --git a/test/plugins/removeElements.03.svg b/test/plugins/removeElementsByAttr.03.svg similarity index 100% rename from test/plugins/removeElements.03.svg rename to test/plugins/removeElementsByAttr.03.svg