Skip to content

Commit

Permalink
Use undefined for default parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
jory committed Sep 30, 2015
1 parent 14baab7 commit 902c730
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class Clipboard extends Emitter {
* @param {Element} trigger
*/
setAction(trigger) {
return trigger.getAttribute(prefix + 'action');
var action = trigger.getAttribute(prefix + 'action');
return action === null ? undefined : action;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/clipboard-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('ClipboardAction', () => {
it('should throw an error since neither "text" nor "target" were passed', done => {
try {
new ClipboardAction({
action: ''
action: undefined
});
}
catch(e) {
Expand Down

0 comments on commit 902c730

Please sign in to comment.