Skip to content

Commit

Permalink
Rename plugin to removeElementsByAttr
Browse files Browse the repository at this point in the history
  • Loading branch information
elidupuis committed Jul 16, 2016
1 parent f4b455a commit 7fd48e9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
19 changes: 10 additions & 9 deletions plugins/removeElements.js → plugins/removeElementsByAttr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
*
Expand All @@ -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()) {
Expand All @@ -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;
}
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes

0 comments on commit 7fd48e9

Please sign in to comment.