mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-17 19:11:08 +00:00
style(select): cleaning up select.js
This commit is contained in:
parent
3692885810
commit
c17c731fdc
1 changed files with 7 additions and 8 deletions
|
|
@ -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
|
// 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 options with no option group
|
||||||
// optionGroupsCache[?][0] is the parent: either the SELECT or OPTGROUP element
|
// optionGroupsCache[?][0] is the parent: either the SELECT or OPTGROUP element
|
||||||
optionGroupsCache = [[{element: selectElement, label:''}]],
|
optionGroupsCache = [[{element: selectElement, label:''}]];
|
||||||
inChangeEvent;
|
|
||||||
|
|
||||||
// find existing special options
|
// find existing special options
|
||||||
forEach(selectElement.children(), function(option) {
|
forEach(selectElement.children(), function(option) {
|
||||||
|
|
@ -358,12 +357,12 @@ angularWidget('select', function(element){
|
||||||
|
|
||||||
if (optionGroupsCache.length <= groupIndex) {
|
if (optionGroupsCache.length <= groupIndex) {
|
||||||
// we need to grow the optionGroups
|
// we need to grow the optionGroups
|
||||||
optionGroupsCache.push(
|
existingParent = {
|
||||||
existingOptions = [existingParent = {
|
element: optGroupTemplate.clone().attr('label', optionGroupName),
|
||||||
element: optGroupTemplate.clone().attr('label', optionGroupName),
|
label: optionGroup.label
|
||||||
label: optionGroup.label
|
};
|
||||||
}]
|
existingOptions = [existingParent];
|
||||||
);
|
optionGroupsCache.push(existingOptions);
|
||||||
selectElement.append(existingParent.element);
|
selectElement.append(existingParent.element);
|
||||||
} else {
|
} else {
|
||||||
existingOptions = optionGroupsCache[groupIndex];
|
existingOptions = optionGroupsCache[groupIndex];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue