Skip to content

Commit e559f92

Browse files
committed
Merge pull request select2#2001 from arendjr/master
Don't rely on :visible and :not(..., ...) selectors which only work with Sizzle
2 parents cd92405 + a6ec8fc commit e559f92

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

select2.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ the specific language governing permissions and limitations under the Apache Lic
272272

273273
/* make sure el received focus so we do not error out when trying to manipulate the caret.
274274
sometimes modals or others listeners may steal it after its set */
275-
if ($el.is(":visible") && el === document.activeElement) {
275+
var isVisible = (el.offsetWidth > 0 || el.offsetHeight > 0);
276+
if (isVisible && el === document.activeElement) {
276277

277278
/* after the focus is set move the caret to the end, necessary when we val()
278279
just before setting focus */
@@ -1453,7 +1454,7 @@ the specific language governing permissions and limitations under the Apache Lic
14531454

14541455
// abstract
14551456
findHighlightableChoices: function() {
1456-
return this.results.find(".select2-result-selectable:not(.select2-disabled, .select2-selected)");
1457+
return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)");
14571458
},
14581459

14591460
// abstract

0 commit comments

Comments
 (0)