mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user