Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 780835f

Browse files
committed
Remove obsolete code
1 parent 2ce5568 commit 780835f

File tree

2 files changed

+5
-25
lines changed

2 files changed

+5
-25
lines changed

src/select.js

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -144,34 +144,18 @@ angular.module('ui.select', [])
144144
compile: function(tElement, tAttrs) {
145145

146146
tElement.querySelectorAll('.ui-select-choices-row')
147-
.attr("ng-repeat", tAttrs.repeat)
148-
.attr("ng-mouseenter", '$select.activeIdx=$index')
149-
.attr("ng-click", '$select.select(item)');
147+
.attr('ng-repeat', tAttrs.repeat)
148+
.attr('ng-mouseenter', '$select.activeIdx = $index')
149+
.attr('ng-click', '$select.select(item)');
150150

151151
return function(scope, element, attrs, $select) {
152152

153153
scope.trustAsHtml = function(value) {
154154
return $sce.trustAsHtml(value);
155155
};
156156

157-
var container = element.hasClass('ui-select-choices-content') ? element : element.querySelectorAll('.ui-select-choices-content');
158-
159-
function ensureHighlightVisible() {
160-
var rows = element.querySelectorAll('.ui-select-choices-row');
161-
if (!rows.length) return;
162-
var highlighted = rows[scope.$select.activeIdx],
163-
posY = highlighted.offsetTop + highlighted.clientHeight - container.scrollTop,
164-
maxHeight = 200; // TODO Need to get this value from container.max-height
165-
if (posY > maxHeight) {
166-
container[0].scrollTop += posY-maxHeight;
167-
} else if (posY < highlighted.clientHeight) {
168-
container[0].scrollTop -= highlighted.clientHeight-posY;
169-
}
170-
}
171-
172157
scope.$watch('$select.search', function() {
173158
scope.$select.activeIdx = 0;
174-
ensureHighlightVisible();
175159
});
176160

177161
// Bind keyboard events related to choices
@@ -184,15 +168,13 @@ angular.module('ui.select', [])
184168

185169
if (evt.which === 40) { // down(40)
186170
if (scope.$select.activeIdx < rows.length) {
187-
scope.$select.activeIdx = (scope.$select.activeIdx + 1) % rows.length || rows.length - 1 ;
188-
ensureHighlightVisible();
171+
scope.$select.activeIdx = (scope.$select.activeIdx + 1) % rows.length || rows.length - 1;
189172
scope.$digest();
190173
}
191174

192175
} else if (evt.which === 38) { // up(38)
193176
if (scope.$select.activeIdx > 0) {
194177
scope.$select.activeIdx--;
195-
ensureHighlightVisible();
196178
scope.$digest();
197179
}
198180

src/selectize/choices.tpl.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<div ng-show="$select.open" class="ui-select-choices selectize-dropdown single">
22
<div class="ui-select-choices-content selectize-dropdown-content">
33
<div class="ui-select-choices-row"
4-
ng-class="{'active': $select.activeIdx == $index}"
5-
ng-click="$select(item)"
6-
ng-mouseenter="$select.index = $index">
4+
ng-class="{'active': $select.activeIdx == $index}">
75
<div class="option" data-selectable ng-transclude></div>
86
</div>
97
</div>

0 commit comments

Comments
 (0)