diff options
| author | Igor Minar | 2011-10-19 22:51:13 -0700 |
|---|---|---|
| committer | Igor Minar | 2011-10-19 22:52:14 -0700 |
| commit | c17c731fdc9c5d00cc606df19c9b36d51e41a8d7 (patch) | |
| tree | 96baa4483a14e5fe33ff448578c0a94bf4a6fa17 | |
| parent | 36928858104ba793dfc7372dbaa28048123d6e63 (diff) | |
| download | angular.js-c17c731fdc9c5d00cc606df19c9b36d51e41a8d7.tar.bz2 | |
style(select): cleaning up select.js
| -rw-r--r-- | src/widget/select.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/widget/select.js b/src/widget/select.js index ba340490..9b9ed172 100644 --- a/src/widget/select.js +++ b/src/widget/select.js @@ -237,8 +237,7 @@ angularWidget('select', function(element){ // This is an array of array of existing option groups in DOM. We try to reuse these if possible // optionGroupsCache[0] is the options with no option group // optionGroupsCache[?][0] is the parent: either the SELECT or OPTGROUP element - optionGroupsCache = [[{element: selectElement, label:''}]], - inChangeEvent; + optionGroupsCache = [[{element: selectElement, label:''}]]; // find existing special options forEach(selectElement.children(), function(option) { @@ -358,12 +357,12 @@ angularWidget('select', function(element){ if (optionGroupsCache.length <= groupIndex) { // we need to grow the optionGroups - optionGroupsCache.push( - existingOptions = [existingParent = { - element: optGroupTemplate.clone().attr('label', optionGroupName), - label: optionGroup.label - }] - ); + existingParent = { + element: optGroupTemplate.clone().attr('label', optionGroupName), + label: optionGroup.label + }; + existingOptions = [existingParent]; + optionGroupsCache.push(existingOptions); selectElement.append(existingParent.element); } else { existingOptions = optionGroupsCache[groupIndex]; |
