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

Commit

Permalink
Revert "fix(ngOptions): skip comments when looking for option elements"
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Narretz committed Oct 7, 2015
1 parent 0c8a9a0 commit beea571
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
5 changes: 1 addition & 4 deletions src/ng/directive/ngOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,10 +621,7 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
if (emptyOption_ || unknownOption_) {
while (current &&
(current === emptyOption_ ||
current === unknownOption_ ||
emptyOption_ && emptyOption_.nodeType === NODE_TYPE_COMMENT)) {
// Empty options might have directives that transclude
// and insert comments (e.g. ngIf)
current === unknownOption_)) {
current = current.nextSibling;
}
}
Expand Down
24 changes: 0 additions & 24 deletions test/ng/directive/ngOptionsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2144,30 +2144,6 @@ describe('ngOptions', function() {
});


it('should be possible to use ngIf in the blank option', function() {
var option;
createSingleSelect('<option ng-if="isBlank" value="">blank</option>');

scope.$apply(function() {
scope.values = [{name: 'A'}];
scope.isBlank = true;
});

expect(element.find('option').length).toBe(2);
option = element.find('option').eq(0);
expect(option.val()).toBe('');
expect(option.text()).toBe('blank');

scope.$apply(function() {
scope.isBlank = false;
});

expect(element.find('option').length).toBe(1);
option = element.find('option').eq(0);
expect(option.text()).toBe('A');
});


it('should not throw when a directive compiles the blank option before ngOptions is linked', function() {
expect(function() {
createSelect({
Expand Down

1 comment on commit beea571

@Starefossen
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, the commit message for this commit is now up to par with the Commit Message Conventions

Please sign in to comment.