Skip to content

Commit 77640d8

Browse files
author
Erin Altenhof-Long
committed
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 7f5e0f0 commit 77640d8

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
@@ -394,12 +394,6 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
394394
value = valueFn(scope, locals);
395395
}
396396
}
397-
// Update the null option's selected property here so $render cleans it up correctly
398-
if (optionGroupsCache[0].length > 1) {
399-
if (optionGroupsCache[0][1].id !== key) {
400-
optionGroupsCache[0][1].selected = false;
401-
}
402-
}
403397
}
404398
ctrl.$setViewValue(value);
405399
});
@@ -537,7 +531,7 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
537531
lastElement.val(existingOption.id = option.id);
538532
}
539533
// lastElement.prop('selected') provided by jQuery has side-effects
540-
if (existingOption.selected !== option.selected) {
534+
if (lastElement[0].selected !== option.selected) {
541535
lastElement.prop('selected', (existingOption.selected = option.selected));
542536
}
543537
} else {

0 commit comments

Comments
 (0)