1
0
mirror of synced 2024-11-26 14:56:07 +03:00

jquery 1.8.x fixes. fixes #388

This commit is contained in:
Igor Vaynberg 2012-09-17 19:52:42 -07:00
parent 2cb435680b
commit f18caa5957

View File

@ -146,7 +146,7 @@
} }
function getSideBorderPadding(element) { function getSideBorderPadding(element) {
return element.outerWidth() - element.width(); return element.outerWidth(false) - element.width();
} }
function installKeyUpChangeEvent(element) { function installKeyUpChangeEvent(element) {
@ -875,9 +875,9 @@
// abstract // abstract
positionDropdown: function() { positionDropdown: function() {
var offset = this.container.offset(), var offset = this.container.offset(),
height = this.container.outerHeight(), height = this.container.outerHeight(true),
width = this.container.outerWidth(), width = this.container.outerWidth(true),
dropHeight = this.dropdown.outerHeight(), dropHeight = this.dropdown.outerHeight(true),
viewportBottom = $(window).scrollTop() + document.documentElement.clientHeight, viewportBottom = $(window).scrollTop() + document.documentElement.clientHeight,
dropTop = offset.top + height, dropTop = offset.top + height,
dropLeft = offset.left, dropLeft = offset.left,
@ -1063,17 +1063,17 @@
child = $(children[index]); child = $(children[index]);
hb = child.offset().top + child.outerHeight(); hb = child.offset().top + child.outerHeight(true);
// if this is the last child lets also make sure select2-more-results is visible // if this is the last child lets also make sure select2-more-results is visible
if (index === children.length - 1) { if (index === children.length - 1) {
more = results.find("li.select2-more-results"); more = results.find("li.select2-more-results");
if (more.length > 0) { if (more.length > 0) {
hb = more.offset().top + more.outerHeight(); hb = more.offset().top + more.outerHeight(true);
} }
} }
rb = results.offset().top + results.outerHeight(); rb = results.offset().top + results.outerHeight(true);
if (hb > rb) { if (hb > rb) {
results.scrollTop(results.scrollTop() + (hb - rb)); results.scrollTop(results.scrollTop() + (hb - rb));
} }
@ -1347,7 +1347,7 @@
if (this.opts.width === "off") { if (this.opts.width === "off") {
return null; return null;
} else if (this.opts.width === "element"){ } else if (this.opts.width === "element"){
return this.opts.element.outerWidth() === 0 ? 'auto' : this.opts.element.outerWidth() + 'px'; return this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px';
} else if (this.opts.width === "copy" || this.opts.width === "resolve") { } else if (this.opts.width === "copy" || this.opts.width === "resolve") {
// check if there is inline style on the element that contains width // check if there is inline style on the element that contains width
style = this.opts.element.attr('style'); style = this.opts.element.attr('style');
@ -1368,7 +1368,7 @@
if (style.indexOf("%") > 0) return style; if (style.indexOf("%") > 0) return style;
// finally, fallback on the calculated width of the element // finally, fallback on the calculated width of the element
return (this.opts.element.outerWidth() === 0 ? 'auto' : this.opts.element.outerWidth() + 'px'); return (this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px');
} }
return null; return null;