ArrayEditable: replace self.$items
When shrinking the number of items, this allows the old elements to be GCed sooner.
This commit is contained in:
parent
84b3c34130
commit
adbf2dad81
1 changed files with 4 additions and 4 deletions
|
@ -142,23 +142,23 @@ Ox.ArrayEditable = function(options, self) {
|
|||
}
|
||||
that.empty();
|
||||
if (self.options.items.length == 0) {
|
||||
self.$items[0] = Ox.Editable({
|
||||
self.$items = [Ox.Editable({
|
||||
editable: false,
|
||||
placeholder: self.options.placeholder,
|
||||
type: self.options.type,
|
||||
value: ''
|
||||
})
|
||||
.appendTo(that);
|
||||
.appendTo(that)];
|
||||
} else {
|
||||
sortItems();
|
||||
self.options.items.forEach(function(item, i) {
|
||||
self.$items = self.options.items.map(function appendItem(item, i) {
|
||||
if (i && self.options.type == 'input') {
|
||||
$('<span>')
|
||||
.addClass('OxSeparator')
|
||||
.html(self.options.separator + ' ')
|
||||
.appendTo(that);
|
||||
}
|
||||
self.$items[i] = Ox.Editable({
|
||||
return Ox.Editable({
|
||||
autocomplete: self.options.autocomplete,
|
||||
autocompleteReplace: self.options.autocompleteReplace,
|
||||
autocompleteReplaceCorrect: self.options.autocompleteReplaceCorrect,
|
||||
|
|
Loading…
Reference in a new issue