Skip to content

Commit

Permalink
Fix for selects not working in IE8
Browse files Browse the repository at this point in the history
angular-ui#158, based on an observed (but maybe not well understood) code change by @careywalker. Basically, just move the ng-click/ng-mouseenter bindings from the LI (choices-row) to the contained DIV (choices-row-inner). So far, I haven't seen an affect on behavior in any browser, but this is with light manual testing.

All automated tests pass with these changes in place:

>gulp test
[15:05:36] Using gulpfile C:\web\sites\ui-select\gulpfile.js
[15:05:36] Starting 'clean'...
[15:05:36] Finished 'clean' after 14 ms
[15:05:36] Starting 'scripts'...
[15:05:36] Starting 'styles'...
[15:05:36] Finished 'styles' after 61 ms
[15:05:37] Finished 'scripts' after 1.01 s
[15:05:37] Starting 'build'...
[15:05:37] Finished 'build' after 14 μs
[15:05:37] Starting 'karma'...
[15:05:38] Finished 'karma' after 880 ms
[15:05:38] Starting 'test'...
[15:05:38] Finished 'test' after 5.63 μs
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 41.0.2272 (Windows 7)]: Connected on socket gaw3nxxZW2Omee4BBX-X with id 17666700
Chrome 41.0.2272 (Windows 7): Executed 110 of 110 SUCCESS (2.483 secs / 2.465 secs)
  • Loading branch information
Josh68 committed Mar 12, 2015
1 parent ed61077 commit 8317a0c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/uiSelectChoicesDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ uis.directive('uiSelectChoices',
}

choices.attr('ng-repeat', RepeatParser.getNgRepeatExpression($select.parserResult.itemName, '$select.items', $select.parserResult.trackByExp, groupByExp))
.attr('ng-if', '$select.open') //Prevent unnecessary watches when dropdown is closed
.attr('ng-mouseenter', '$select.setActiveItem('+$select.parserResult.itemName +')')
.attr('ng-click', '$select.select(' + $select.parserResult.itemName + ',false,$event)');
.attr('ng-if', '$select.open'); //Prevent unnecessary watches when dropdown is closed

var rowsInner = element.querySelectorAll('.ui-select-choices-row-inner');
if (rowsInner.length !== 1) throw uiSelectMinErr('rows', "Expected 1 .ui-select-choices-row-inner but got '{0}'.", rowsInner.length);
rowsInner.attr('uis-transclude-append', ''); //Adding uisTranscludeAppend directive to row element after choices element has ngRepeat

rowsInner.attr('uis-transclude-append', '') //Adding uisTranscludeAppend directive to row element after choices element has ngRepeat
.attr('ng-mouseenter', '$select.setActiveItem('+$select.parserResult.itemName +')')
.attr('ng-click', '$select.select(' + $select.parserResult.itemName + ',false,$event)');

$compile(element, transcludeFn)(scope); //Passing current transcludeFn to be able to append elements correctly from uisTranscludeAppend

scope.$watch('$select.search', function(newValue) {
Expand Down

0 comments on commit 8317a0c

Please sign in to comment.