diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2014-08-07 08:40:48 -0400 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2014-08-12 19:30:09 -0400 |
commit | 67e4b44b295517cb81ced7b6c41fd9898a45d0d9 (patch) | |
tree | 90f61cd63deb2f7dd2d057886d108d846122d2ae /ui/core.js | |
parent | 2ac07699677de33a93d6d22cf612039b8637bd2e (diff) | |
download | jquery-ui-67e4b44b295517cb81ced7b6c41fd9898a45d0d9.tar.gz jquery-ui-67e4b44b295517cb81ced7b6c41fd9898a45d0d9.zip |
Core: provide "includeHidden" parameter in $.ui.scrollParent
Even though the user is unable to scroll via the UI, authors
may have custom scrollbars that programmatically set scrollTop.
Therefore, overflow:hidden can be considered a scrollParent.
Diffstat (limited to 'ui/core.js')
-rw-r--r-- | ui/core.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ui/core.js b/ui/core.js index aa1ee0f3d..0bcb46aa7 100644 --- a/ui/core.js +++ b/ui/core.js @@ -48,15 +48,16 @@ $.extend( $.ui, { // plugins $.fn.extend({ - scrollParent: function() { + scrollParent: function( includeHidden ) { var position = this.css( "position" ), excludeStaticParent = position === "absolute", + overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, scrollParent = this.parents().filter( function() { var parent = $( this ); if ( excludeStaticParent && parent.css( "position" ) === "static" ) { return false; } - return (/(auto|scroll)/).test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) ); + return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) ); }).eq( 0 ); return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent; |