I'm having a problem understanding chaining. I have this code fragment:
groups.appendTo(this.selectedList.add(this.availableList));
Initially, both selectedList and availableList are identical, and contain an HTML ul with a single li element. groups is another ul with 4 li elements. On completion, both this.selectedList and this.availableList have been modified, and contain the new list items.
How does this work, and what exactly is the add doing here? It doesn't add the contents of the available list to the selected list. I also thought that add returned a temporary object? And why is this code any better than:
groups.appendTo(this.AvailableList);
groups.appendTo(this.selectedList);
Thanks.
EDIT
The context is:
(function($) {
$.widget("ui.multiselect", {
options: {...},
_func: function() {
... local 'this':
groups.appendTo(this.selectedList.add(this.availableList));
}
});
})(jQuery);