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

Commit 0e6a700

Browse files
committed
Revert "fix(ngOptions): skip comments when looking for option elements"
This reverts commit 68d4dc5. 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 4fc40bc commit 0e6a700

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
@@ -625,10 +625,7 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
625625
if (emptyOption_ || unknownOption_) {
626626
while (current &&
627627
(current === emptyOption_ ||
628-
current === unknownOption_ ||
629-
emptyOption_ && emptyOption_.nodeType === NODE_TYPE_COMMENT)) {
630-
// Empty options might have directives that transclude
631-
// and insert comments (e.g. ngIf)
628+
current === unknownOption_)) {
632629
current = current.nextSibling;
633630
}
634631
}

test/ng/directive/ngOptionsSpec.js

-24
Original file line numberDiff line numberDiff line change
@@ -2135,30 +2135,6 @@ describe('ngOptions', function() {
21352135
});
21362136

21372137

2138-
it('should be possible to use ngIf in the blank option', function() {
2139-
var option;
2140-
createSingleSelect('<option ng-if="isBlank" value="">blank</option>');
2141-
2142-
scope.$apply(function() {
2143-
scope.values = [{name: 'A'}];
2144-
scope.isBlank = true;
2145-
});
2146-
2147-
expect(element.find('option').length).toBe(2);
2148-
option = element.find('option').eq(0);
2149-
expect(option.val()).toBe('');
2150-
expect(option.text()).toBe('blank');
2151-
2152-
scope.$apply(function() {
2153-
scope.isBlank = false;
2154-
});
2155-
2156-
expect(element.find('option').length).toBe(1);
2157-
option = element.find('option').eq(0);
2158-
expect(option.text()).toBe('A');
2159-
});
2160-
2161-
21622138
it('should not throw when a directive compiles the blank option before ngOptions is linked', function() {
21632139
expect(function() {
21642140
createSelect({

0 commit comments

Comments
 (0)