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

Commit 59a6440

Browse files
WIP: improve comment
1 parent ca526a0 commit 59a6440

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/ng/directive/select.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ var SelectController =
4242
if (self.unknownOption.parent()) self.unknownOption.remove();
4343
};
4444

45-
// The "empty" option is one that has a value of '' and can be provided as a child of
46-
// the `select` element.
47-
// In the basic select, we only need to use this to make IE9 happy when we set the select's
48-
// value to '', but also ngOption uses this for its own purposes too.
45+
// Here we find the option that represents the "empty" value, i.e. the option with a value
46+
// of `""`. This option needs to be accessed (to select it directly) when setting the value
47+
// of the select to `""` because IE9 will not automatically select the option.
48+
//
49+
// Additionally, the `ngOptions` directive uses this option to allow the application developer
50+
// to provide their own custom "empty" option when the viewValue does not match any of the
51+
// option values.
4952
for (var i = 0, children = $element.children(), ii = children.length; i < ii; i++) {
5053
if (children[i].value === '') {
5154
self.emptyOption = children.eq(i);

0 commit comments

Comments
 (0)