ivaynberg/select2 — pull request #1794 by RichardOtvos (2013-10-14 10:34:15+00:00)
Title: Added Zepto compatibility. Please see my messages in the pull request.

So, I've ported the select2 plugin to work with Zepto, this pull request gonna be a little lengthy, but please bear with me.

**Zepto requirements**
Besides the modules included in Zepto by default it also, needs the data and selector Zepto module.

**What is changed?**
Firstly, if you use jQuery the code is the same, I used safety checks so it only uses the modified code, if you use Zepto.
- **`$`** - the plugin can use both jQuery and Zepto, but it prioritizes jQuery if you have both
- **`outerWidth, outerHeight`** - it uses `width()`, and `height()` instead which is the same in Zepto as `outerHeight(false)` / `outerWidth(false)` in jQuery.
- **`scrollLeft()`** - this isnt availabale in Zepto for some reason (they have scrollTop, so I don't understand why) Now if you use the plugin with Zepto it adds the `scrollLeft()` function to the `$` object. I also sent a pull request to Zepto with the same implementation, but until they accept it, it is here and it works
- **`addClas(), toggleClass()`** -there is a bug in Zepto, if you call these two function with empty parameters it freezes, the script (as it will try to acces the split() method of a undefined or a null object). I fixed it here and also sent a pull request to Zepto.
- ** updated selectors ** - if you use Zepto instead of the `$(':not')` selector, you use the `$.fn.not()` function, which does the same thing basically.
- ** CSS changes ** - I added a class if you are using Zepto, so you can easily detect it. Also when the dropdown is open you can't see the selecteed choice by default, so I added a CSS rule that sets it z-index higher (but only if you are using Zepto

I think these are the most important changes, I made.

**How these changes enlarge the plugin's size?**
I only checked the unminified version. The plugin's size is increased by 2 kilobytes, the CSS's increased by kilobyte. This includes some patches to Zepto (like the scrollLeft and addClass functions) which can be removed when/if they accept my pull requests. (of course that would also mean loosing backward compatibility too)

**So really EVERYTHING works?**
If you are using jQuery it uses the same code so, yeah everything. For the Zepto, as I couldn't find any tests its hard to tell. I only needed a very minimal select (only used the minimumWidth and minimumResultsForSearch options), and that works perfectly. If you find issues with it I'm willing to contribute and fix it, so just add them as issues.