Skip to content

Commit f18caa5

Browse files
committed
jquery 1.8.x fixes. fixes select2#388
1 parent 2cb4356 commit f18caa5

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

select2.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
}
147147

148148
function getSideBorderPadding(element) {
149-
return element.outerWidth() - element.width();
149+
return element.outerWidth(false) - element.width();
150150
}
151151

152152
function installKeyUpChangeEvent(element) {
@@ -875,9 +875,9 @@
875875
// abstract
876876
positionDropdown: function() {
877877
var offset = this.container.offset(),
878-
height = this.container.outerHeight(),
879-
width = this.container.outerWidth(),
880-
dropHeight = this.dropdown.outerHeight(),
878+
height = this.container.outerHeight(true),
879+
width = this.container.outerWidth(true),
880+
dropHeight = this.dropdown.outerHeight(true),
881881
viewportBottom = $(window).scrollTop() + document.documentElement.clientHeight,
882882
dropTop = offset.top + height,
883883
dropLeft = offset.left,
@@ -1063,17 +1063,17 @@
10631063

10641064
child = $(children[index]);
10651065

1066-
hb = child.offset().top + child.outerHeight();
1066+
hb = child.offset().top + child.outerHeight(true);
10671067

10681068
// if this is the last child lets also make sure select2-more-results is visible
10691069
if (index === children.length - 1) {
10701070
more = results.find("li.select2-more-results");
10711071
if (more.length > 0) {
1072-
hb = more.offset().top + more.outerHeight();
1072+
hb = more.offset().top + more.outerHeight(true);
10731073
}
10741074
}
10751075

1076-
rb = results.offset().top + results.outerHeight();
1076+
rb = results.offset().top + results.outerHeight(true);
10771077
if (hb > rb) {
10781078
results.scrollTop(results.scrollTop() + (hb - rb));
10791079
}
@@ -1347,7 +1347,7 @@
13471347
if (this.opts.width === "off") {
13481348
return null;
13491349
} else if (this.opts.width === "element"){
1350-
return this.opts.element.outerWidth() === 0 ? 'auto' : this.opts.element.outerWidth() + 'px';
1350+
return this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px';
13511351
} else if (this.opts.width === "copy" || this.opts.width === "resolve") {
13521352
// check if there is inline style on the element that contains width
13531353
style = this.opts.element.attr('style');
@@ -1368,7 +1368,7 @@
13681368
if (style.indexOf("%") > 0) return style;
13691369

13701370
// finally, fallback on the calculated width of the element
1371-
return (this.opts.element.outerWidth() === 0 ? 'auto' : this.opts.element.outerWidth() + 'px');
1371+
return (this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px');
13721372
}
13731373

13741374
return null;

0 commit comments

Comments
 (0)