Fixing IE8 and IE9 issues on select2#3.5.1

It's the same as PR #2492 by @vitormil, with requested changes.