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

Commit beea571

Browse files
committed
Revert "fix(ngOptions): skip comments when looking for option elements"
This reverts commit 7f3f3dd. The fix only fixed a specific case and exhibited a flawed logic (namely skipping every option if the emptyOption is a comment). See #12190 (comment) Conflicts: test/ng/directive/ngOptionsSpec.js
1 parent 0c8a9a0 commit beea571

File tree

2 files changed

+1
-28
lines changed

2 files changed

+1
-28
lines changed

src/ng/directive/ngOptions.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,7 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
621621
if (emptyOption_ || unknownOption_) {
622622
while (current &&
623623
(current === emptyOption_ ||
624-
current === unknownOption_ ||
625-
emptyOption_ && emptyOption_.nodeType === NODE_TYPE_COMMENT)) {
626-
// Empty options might have directives that transclude
627-
// and insert comments (e.g. ngIf)
624+
current === unknownOption_)) {
628625
current = current.nextSibling;
629626
}
630627
}

test/ng/directive/ngOptionsSpec.js

-24
Original file line numberDiff line numberDiff line change
@@ -2144,30 +2144,6 @@ describe('ngOptions', function() {
21442144
});
21452145

21462146

2147-
it('should be possible to use ngIf in the blank option', function() {
2148-
var option;
2149-
createSingleSelect('<option ng-if="isBlank" value="">blank</option>');
2150-
2151-
scope.$apply(function() {
2152-
scope.values = [{name: 'A'}];
2153-
scope.isBlank = true;
2154-
});
2155-
2156-
expect(element.find('option').length).toBe(2);
2157-
option = element.find('option').eq(0);
2158-
expect(option.val()).toBe('');
2159-
expect(option.text()).toBe('blank');
2160-
2161-
scope.$apply(function() {
2162-
scope.isBlank = false;
2163-
});
2164-
2165-
expect(element.find('option').length).toBe(1);
2166-
option = element.find('option').eq(0);
2167-
expect(option.text()).toBe('A');
2168-
});
2169-
2170-
21712147
it('should not throw when a directive compiles the blank option before ngOptions is linked', function() {
21722148
expect(function() {
21732149
createSelect({

0 commit comments

Comments
 (0)