mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Use undefined for default parameters
This commit is contained in:
@ -39,7 +39,8 @@ class Clipboard extends Emitter {
|
|||||||
* @param {Element} trigger
|
* @param {Element} trigger
|
||||||
*/
|
*/
|
||||||
setAction(trigger) {
|
setAction(trigger) {
|
||||||
return trigger.getAttribute(prefix + 'action');
|
var action = trigger.getAttribute(prefix + 'action');
|
||||||
|
return action === null ? undefined : action;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +36,7 @@ describe('ClipboardAction', () => {
|
|||||||
it('should throw an error since neither "text" nor "target" were passed', done => {
|
it('should throw an error since neither "text" nor "target" were passed', done => {
|
||||||
try {
|
try {
|
||||||
new ClipboardAction({
|
new ClipboardAction({
|
||||||
action: ''
|
action: undefined
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
|
Reference in New Issue
Block a user