Debian Codegraph @

ui/scroll-parent.js

raw symbols SCIP
1 /*!
2 * jQuery UI Scroll Parent 1.14.2
3 * https://jqueryui.com
4 *
5 * Copyright OpenJS Foundation and other contributors
6 * Released under the MIT license.
7 * https://jquery.org/license
8 */
9
10 //>>label: scrollParent
11 //>>group: Core
12 //>>description: Get the closest ancestor element that is scrollable.
13 //>>docs: https://api.jqueryui.com/scrollParent/
14
15 ( function( factory ) {
16 "use strict";
17
18 if ( typeof define === "function" && define.amd ) {
19
20 // AMD. Register as an anonymous module.
21 define( [ "jquery", "./version" ], factory );
22 } else {
23
24 // Browser globals
25 factory( jQuery );
26 }
27 } )( function( $ ) {
28 "use strict";
29
30 return $.fn.scrollParent = function( includeHidden ) {
31 var position = this.css( "position" ),
32 excludeStaticParent = position === "absolute",
33 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
34 scrollParent = this.parents().filter( function() {
35 var parent = $( this );
36 if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
37 return false;
38 }
39 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +
40 parent.css( "overflow-x" ) );
41 } ).eq( 0 );
42
43 return position === "fixed" || !scrollParent.length ?
44 $( this[ 0 ].ownerDocument || document ) :
45 scrollParent;
46 };
47
48 } );