Fixing IE8 and IE9 issues on select2#3.5.0

I'm just adding some tests to make sure that the object exists before use it. It's necessary to make the code compatible with IE8 and IE9.

After this update the plugin worked properly on IE8 and IE9.