Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit dcc9b5e

Browse files
committed
fixup simplify
1 parent a8498d2 commit dcc9b5e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/ng/directive/select.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ var noopNgModelController = { $setViewValue: noop, $render: noop };
66

77
function setOptionSelectedStatus(optionEl, value) {
88
optionEl.prop('selected', value); // needed for IE
9-
if (value) {
10-
optionEl.attr('selected', value);
11-
} else {
12-
// Technically, setting the property to null / false is enough to unselect the option
13-
// However, screenreaders might react to the selected attribute instead, see
14-
// https://github.com/angular/angular.js/issues/14419
15-
optionEl.removeAttr('selected');
16-
}
9+
/**
10+
* When unselecting an option, setting the property to null / false should be enough
11+
* However, screenreaders might react to the selected attribute instead, see
12+
* https://github.com/angular/angular.js/issues/14419
13+
*/
14+
optionEl.attr('selected', value || null);
1715
}
1816

1917
/**

0 commit comments

Comments
 (0)