Merge branch 'master' of github.com:zenorocha/clipboard.js into feature-732-removing-dom-el

* 'master' of github.com:zenorocha/clipboard.js:
  refactor(workflows): remove unused lint file
  feat(workflows): add lint code job
  chore(eslint): add comments and new rules
  chore(deps): remove sort-package-json
  refactor: remove eslint ignore rules comments
  ci(lint): create a ci workflow
  chore(clipboard): remove linter bugs
  chore(deps): add dependencies and new scripts
  chore(test): remove linter bugs
  chore(linter): add linter configuration
  feat(eslint): add linter configuration
  chore(deps): add linter
  updating naming
  adding deploy action
This commit is contained in:
vitormalencar
2021-02-25 16:21:53 +01:00
8 changed files with 1076 additions and 31 deletions

View File

@@ -1,6 +1,21 @@
import ClipboardAction from './clipboard-action';
import Emitter from 'tiny-emitter';
import listen from 'good-listener';
import ClipboardAction from './clipboard-action';
/**
* Helper function to retrieve attribute value.
* @param {String} suffix
* @param {Element} element
*/
function getAttributeValue(suffix, element) {
const attribute = `data-clipboard-${suffix}`;
if (!element.hasAttribute(attribute)) {
return;
}
return element.getAttribute(attribute);
}
/**
* Base class which takes one or more elements, adds event listeners to them,
@@ -62,7 +77,7 @@ class Clipboard extends Emitter {
target: this.target(trigger),
text: this.text(trigger),
container: this.container,
trigger: trigger,
trigger,
emitter: this,
});
}
@@ -124,19 +139,4 @@ class Clipboard extends Emitter {
}
}
/**
* Helper function to retrieve attribute value.
* @param {String} suffix
* @param {Element} element
*/
function getAttributeValue(suffix, element) {
const attribute = `data-clipboard-${suffix}`;
if (!element.hasAttribute(attribute)) {
return;
}
return element.getAttribute(attribute);
}
export default Clipboard;