Skip to content

Commit 49c65f1

Browse files
Erin Altenhof-Longpetebacondarwin
Erin Altenhof-Long
authored andcommitted
revert(select): avoid checking option element selected properties in render
This reverts commit dc149de. That commit fixes a bug caused by Firefox updating `select.value` on hover. However, it causes other bugs with select including the issue described in angular#7715. This issue details how selects with a blank disabled option skip to the second option. We filed a bug with Firefox for the problematic behavior the reverted commit addresses https://bugzilla.mozilla.org/show_bug.cgi?id=1039047, and alternate Angular fixes are being investigated. The test introduced in this commit does test a valid case and is therefore not reverted. Closes angular#7715 angular#7855
1 parent 9025113 commit 49c65f1

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/ng/directive/select.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,6 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
405405
value = valueFn(scope, locals);
406406
}
407407
}
408-
// Update the null option's selected property here so $render cleans it up correctly
409-
if (optionGroupsCache[0].length > 1) {
410-
if (optionGroupsCache[0][1].id !== key) {
411-
optionGroupsCache[0][1].selected = false;
412-
}
413-
}
414408
}
415409
ctrl.$setViewValue(value);
416410
});
@@ -548,7 +542,7 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
548542
lastElement.val(existingOption.id = option.id);
549543
}
550544
// lastElement.prop('selected') provided by jQuery has side-effects
551-
if (existingOption.selected !== option.selected) {
545+
if (lastElement[0].selected !== option.selected) {
552546
lastElement.prop('selected', (existingOption.selected = option.selected));
553547
if (msie) {
554548
// See #7692

0 commit comments

Comments
 (0)