Use undefined for default parameters

This commit is contained in:
Jory Graham 2015-09-29 20:09:17 -04:00
parent 14baab7386
commit 902c730a4d
2 changed files with 3 additions and 2 deletions

View File

@ -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;
}
/**

View File

@ -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) {