Skip to content

Commit e1b003b

Browse files
committed
Refactor Padding
1 parent 79594a8 commit e1b003b

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/ui-scroll.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -197,25 +197,21 @@ angular.module('ui.scroll', [])
197197
}
198198

199199
function Padding(template) {
200-
var div, result, table, tagName;
201-
tagName = template.localName;
202-
203-
if (tagName === 'dl') {
204-
throw new Error('ui-scroll directive does not support <' + tagName + '> as a repeating tag: ' + template.outerHTML);
205-
}
206-
207-
if (tagName !== 'li' && tagName !== 'tr') {
208-
tagName = 'div';
209-
}
200+
let result;
201+
let tagName = template.localName;
210202

211203
switch (tagName) {
204+
case 'dl':
205+
throw new Error(`ui-scroll directive does not support <${tagName}> as a repeating tag: ${template.outerHTML}`);
212206
case 'tr':
213-
table = angular.element('<table><tr><td><div></div></td></tr></table>');
214-
div = table.find('div');
207+
let table = angular.element('<table><tr><td><div></div></td></tr></table>');
215208
result = table.find('tr');
216209
break;
210+
case 'li':
211+
result = angular.element('<li></li>');
212+
break;
217213
default:
218-
result = angular.element('<' + tagName + '></' + tagName + '>');
214+
result = angular.element('<div></div>');
219215
}
220216

221217
return result;

0 commit comments

Comments
 (0)