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