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

Commit 091bbc8

Browse files
committedApr 13, 2016
simplify2
1 parent a3680e1 commit 091bbc8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎src/ng/directive/ngOptions.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,10 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
432432

433433
var options;
434434
var ngOptions = parseOptionsExpression(attr.ngOptions, selectElement, scope);
435-
435+
// This stores the newly created options before they are appended to the select.
436+
// Since the contents are removed from the fragment when it is appended,
437+
// we only need to create it once.
438+
var listFragment = $document[0].createDocumentFragment();
436439

437440
var renderEmptyOption = function() {
438441
if (!providedEmptyOption) {
@@ -637,7 +640,6 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
637640
options = ngOptions.getOptions();
638641

639642
var groupElementMap = {};
640-
var listFragment = $document[0].createDocumentFragment();
641643

642644
// Ensure that the empty option is always there if it was explicitly provided
643645
if (providedEmptyOption) {

0 commit comments

Comments
 (0)