Select2 v4 vs. Select3

1,189 views
Skip to first unread message

are...@gmail.com

unread,
Jan 6, 2015, 12:41:55 PM1/6/15
to sel...@googlegroups.com
Hi all,

I realize the timing of this announcement is a bit unfortunate, but I hope you will bear with me...

First of all, I want to congratulate you all with your first beta release of version 4 of Select2! I've checked out the sources today and it looks like a great improvement over the current production versions. I believe the modularization of Select2 as witnessed with version 4 was long overdue. So long even that just last week I decided to create a new modular, unit tested implementation of Select2 myself: Select3.

As I said, the timing is unfortunate as only today I learned of the existence of Select2 v4. Had I known this last week I'm not sure I would've started work on Select3. I guess nobody is to blame for this but me, and in the worst case I've only wasted my own time, but it does present us with an interesting situation: There are now two independent, modular jQuery selection libraries :)

As it is, I don't regret creating Select3 and I even think it still has some unique selling points that are sufficient for me to keep using it. Of course, I still hope others will share that opinion :)

Here are some advantages of each as I currently see them:

Select2 v4 pros:
- Builds on existing Select2 sources which are widely supported and tested (even though version it is a huge step from version 3 as well)
- Support for hierarchical results
- Support for sorting and reordering selections
- Easier AJAX support
- More options and events implemented
- Supports IE8 and 9

Select3 pros:
- All templates are easily customizable
- Works with Zepto.js and jQuery builds without Sizzle
- Tokenizer support (this is in Select2 v3 as well, but seems removed in v4?)
- Email input type
- More lightweight (smaller file sizes)

Of course, given that Select3 is only one week old, anyone trying it out should still expect some rough edges. Nevertheless, I'm happy with how far it has already come and expect to roll it out on a large production site somewhere in the coming weeks (meaning I think it is in quite good shape already).

For those interested, here is the project page: https://github.com/arendjr/select3

I hope Select2 and Select3 will happily exist next to each other and hopefully push each other to keep improving.

Cheers!
Arend jr.

Kevin Brown

unread,
Jan 6, 2015, 8:39:10 PM1/6/15
to sel...@googlegroups.com
Hi Arend,

I checked out Select3 and it looks really nice. I've left a few comments in response to your message below.

Hi all,

I realize the timing of this announcement is a bit unfortunate, but I hope you will bear with me...

First of all, I want to congratulate you all with your first beta release of version 4 of Select2! I've checked out the sources today and it looks like a great improvement over the current production versions. I believe the modularization of Select2 as witnessed with version 4 was long overdue. So long even that just last week I decided to create a new modular, unit tested implementation of Select2 myself: Select3.

As I said, the timing is unfortunate as only today I learned of the existence of Select2 v4. Had I known this last week I'm not sure I would've started work on Select3. I guess nobody is to blame for this but me, and in the worst case I've only wasted my own time, but it does present us with an interesting situation: There are now two independent, modular jQuery selection libraries :)

I'm always open to the idea of integrating some of your changes back into Select2 4.0.


Select3 pros:
- All templates are easily customizable

This is something I tried to make easier in 4.0 (all adapters have a `.render` method you can override and template), but I can definitely see how it's easier to override with Select3. Surprisingly this hasn't been a common feature request, but I can definitely see how it would be useful.


- Works with Zepto.js and jQuery builds without Sizzle

Now that we have tests with 4.0, supporting Zepto shouldn't be as much of a moving target as it was before. Unfortunately that will require some initial work (shouldn't be too much) to bring 4.0 up to speed, but a few tests against Zepto should allow us to ensure that the compatibility isn't broken in the future.

I think 4.0 no longer relies on Sizzle, though that's not something I've tracked as much.


- Tokenizer support (this is in Select2 v3 as well, but seems removed in v4?)

This is now in 4.0, thanks for the reminder. :)

- Email input type

I'm not exactly sure what the benefit of this is, aside from possibly a special built-in tokenizer?


- More lightweight (smaller file sizes)

This is something I've tried to keep an eye on, though right now Select2 4 comes in at slightly over 50kb when it is minified. Right now we have the potential to cut this down even further, except I've been struggling to get the defaults to work while not explicitly requiring that a package exists.


Of course, given that Select3 is only one week old, anyone trying it out should still expect some rough edges. Nevertheless, I'm happy with how far it has already come and expect to roll it out on a large production site somewhere in the coming weeks (meaning I think it is in quite good shape already).

For those interested, here is the project page: https://github.com/arendjr/select3

I hope Select2 and Select3 will happily exist next to each other and hopefully push each other to keep improving.

Cheers!
Arend jr.


Kevin Brown

Arend van Beelen

unread,
Jan 7, 2015, 3:37:36 AM1/7/15
to sel...@googlegroups.com
Thanks! There are a few points I would like to comment on.

On Wed Jan 07 2015 at 2:39:10 AM Kevin Brown <ke...@kevinbrown.in> wrote:
Hi Arend,

I checked out Select3 and it looks really nice. I've left a few comments in response to your message below.

Hi all,

I realize the timing of this announcement is a bit unfortunate, but I hope you will bear with me...

First of all, I want to congratulate you all with your first beta release of version 4 of Select2! I've checked out the sources today and it looks like a great improvement over the current production versions. I believe the modularization of Select2 as witnessed with version 4 was long overdue. So long even that just last week I decided to create a new modular, unit tested implementation of Select2 myself: Select3.

As I said, the timing is unfortunate as only today I learned of the existence of Select2 v4. Had I known this last week I'm not sure I would've started work on Select3. I guess nobody is to blame for this but me, and in the worst case I've only wasted my own time, but it does present us with an interesting situation: There are now two independent, modular jQuery selection libraries :)

I'm always open to the idea of integrating some of your changes back     into Select2 4.0.

Cool, I think that's the best way both projects can benefit.

This does present a rather dull question about licensing... I thought Select2 uses the MIT license, but now I'm not so sure. It says MIT license in the footer on the website, but the LICENSE file in the repository mentions an Apache/GPL dual-license. So which should I believe?

I've chosen to use MIT for Select3 myself, but if your code is Apache/GPL-licensed I would not be able to take any of your code while you can copy freely from Select3.

Mind you, Select3 is a from-scratch reimplementation and I've copied no code (except for the diacritics map :), but with the much improved code in v4 I can imagine I would be interested in some more of your code as well :)

- Email input type

I'm not exactly sure what the benefit of this is, aside from possibly a special built-in tokenizer?

It's mostly just a special-purpose tokenizer, yes. The other thing that makes it interesting is that's it's a good use case of using Select3 without any dropdown. I'm not sure about v4, but I think the only way to accomplish this with Select2 v3 was to attach a listener to the 'select2-opening' event and always call preventDefault() on it, which is why I decided to just add a 'showDropdown' option to Select3 :)

Cheers,
Arend jr.

Kevin Brown

unread,
Jan 7, 2015, 12:26:10 PM1/7/15
to sel...@googlegroups.com

> This does present a rather dull question about licensing... I thought
> Select2 uses the MIT license, but now I'm not so sure. It says MIT
> license in the footer on the website, but the LICENSE file in the
> repository mentions an Apache/GPL dual-license. So which should I believe?

Select2 3.x (master branch) and below are dual licensed through the
Apache and GPL v2 licenses. For Select2 4.0 (select2-ng branch), we
migrated to the MIT license. Once we get a release candidate out, the
branches will be renamed and the documentation will point to the correct
LICENSE file.

https://github.com/select2/select2/blob/master/LICENSE
https://github.com/select2/select2/blob/select2-ng/LICENSE.md

Kevin Brown

p.w...@gmail.com

unread,
Feb 26, 2015, 7:24:01 PM2/26/15
to sel...@googlegroups.com, are...@gmail.com
@Arend --

I for one applaud your efforts and really like select3. I find the docs easier to parse & understand than the new select2 4.0 docs.

Also, having the query option enables something like https://github.com/stephjang/placecomplete to be implemented with select3, while I don't think this is currently possible with select2 4.0.

So nice work! I'm going to evaluate whether or not I can use it in my project.

-S

p.w...@gmail.com

unread,
Feb 26, 2015, 7:40:32 PM2/26/15
to sel...@googlegroups.com, are...@gmail.com, p.w...@gmail.com
On Thursday, February 26, 2015 at 4:24:01 PM UTC-8, p.w...@gmail.com wrote:
> @Arend --
>
> I for one applaud your efforts and really like select3. I find the docs easier to parse & understand than the new select2 4.0 docs.
>
> Also, having the query option enables something like https://github.com/stephjang/placecomplete to be implemented with select3, while I don't think this is currently possible with select2 4.0.

Sigh. Think I figured it out. See above note about the docs ;)

-S
Reply all
Reply to author
Forward
0 new messages