harvesthq/chosen — pull request #1387 by koenpunt (2013-07-22 22:17:05+00:00)
Title: Feature: Default options

I took a stab at making default options configurable.

For the jQuery version defaults can be set like:

```javascript
$.fn.chosen.defaults.allow_single_deselect = true;
$('.chzn-select').chosen();

// or

$.fn.chosen.defaults = {allow_single_deselect: true};
$('.chzn-select').chosen();

```

And for the Prototype version:

```javascript
Chosen.default_options.allow_single_deselect = true;
new Chosen($$('.chzn-select')[0]);

// or

Chosen.default_options = {allow_single_deselect: true};
new Chosen($$('.chzn-select')[0]);
```

I'm not quite sure about the merging, because in the jQuery version `$.fn.chosen.defaults` starts as a reference to `AbstractChosen.default_options`, but when `$.fn.chosen.defaults` gets overwritten the actual defaults are lost. So when instantiating I need to merge `AbstractChosen.default_options`, `$.fn.chosen.defaults` and `options` to get the correct options.

@harvesthq/chosen-developers: what are your thoughts on defaults?