From 24864de57d9cbfb648c06a26af6a3872d9a14496 Mon Sep 17 00:00:00 2001 From: Scott González Date: Wed, 11 May 2011 08:37:27 -0400 Subject: Menu: Use appropriate methods for getting scroll values for .prop()/.attr() compat. Fixes #7354 - Autocomplete: Scrollable results don't visually update with jQuery 1.6. --- ui/jquery.ui.menu.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 3cc25062c..6126b4da9 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -239,13 +239,13 @@ $.widget("ui.menu", { var borderTop = parseFloat( $.curCSS( this.element[0], "borderTopWidth", true) ) || 0, paddingtop = parseFloat( $.curCSS( this.element[0], "paddingTop", true) ) || 0, offset = item.offset().top - this.element.offset().top - borderTop - paddingtop, - scroll = this.element.attr( "scrollTop" ), + scroll = this.element.scrollTop(), elementHeight = this.element.height(), itemHeight = item.height(); if ( offset < 0 ) { - this.element.attr( "scrollTop", scroll + offset ); + this.element.scrollTop( scroll + offset ); } else if ( offset + itemHeight > elementHeight ) { - this.element.attr( "scrollTop", scroll + offset - elementHeight + itemHeight ); + this.element.scrollTop( scroll + offset - elementHeight + itemHeight ); } } @@ -410,7 +410,8 @@ $.widget("ui.menu", { }, _hasScroll: function() { - return this.element.height() < this.element.attr( "scrollHeight" ); + // TODO: just use .prop() when we drop support for jQuery <1.6 + return this.element.height() < this.element[ $.fn.prop ? "prop" : "attr" ]( "scrollHeight" ); }, select: function( event ) { -- cgit v1.2.3