Skip to content

Commit fb82bc5

Browse files
committed
change if to which
1 parent 360bd78 commit fb82bc5

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/pen.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,18 +214,17 @@
214214

215215
effects.forEach(function(item) {
216216
var tag = item.nodeName.toLowerCase();
217-
if(tag === 'a') {
218-
menu.querySelector('input').value = item.href;
219-
return highlight('createlink');
217+
switch(tag) {
218+
case 'a': return (menu.querySelector('input').value = item.href), highlight('createlink');
219+
case 'i': return highlight('italic');
220+
case 'u': return highlight('underline');
221+
case 'b': return highlight('bold');
222+
case 'ul': return highlight('insertunorderedlist');
223+
case 'ol': return highlight('insertorderedlist');
224+
case 'ol': return highlight('insertorderedlist');
225+
case 'li': return highlight('indent');
226+
default : highlight(tag);
220227
}
221-
if(tag === 'i') return highlight('italic');
222-
if(tag === 'u') return highlight('underline');
223-
if(tag === 'b') return highlight('bold');
224-
if(tag === 'ul') return highlight('insertunorderedlist');
225-
if(tag === 'ol') return highlight('insertorderedlist');
226-
if(tag === 'ol') return highlight('insertorderedlist');
227-
if(tag === 'li') return highlight('indent');
228-
return highlight(tag);
229228
});
230229

231230
return this;

0 commit comments

Comments
 (0)