@@ -215,10 +215,10 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
215215
216216 /**
217217 * Disables scroll around the passed parent element.
218- * @param element Unused
218+ * @param { !Element|!angular.JQLite } element Origin Element (not used)
219219 * @param {!Element|!angular.JQLite } parent Element to disable scrolling within.
220220 * Defaults to body if none supplied.
221- * @param options Object of options to modify functionality
221+ * @param { Object= } options Object of options to modify functionality
222222 * - disableScrollMask Boolean of whether or not to create a scroll mask element or
223223 * use the passed parent element.
224224 */
@@ -234,7 +234,7 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
234234
235235 var body = $document [ 0 ] . body ;
236236 var restoreBody = disableBodyScroll ( ) ;
237- var restoreElement = disableElementScroll ( parent ) ;
237+ var restoreElement = disableElementScroll ( parent , options ) ;
238238
239239 return $mdUtil . disableScrollAround . _restoreScroll = function ( ) {
240240 if ( -- $mdUtil . disableScrollAround . _count <= 0 ) {
@@ -247,21 +247,29 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
247247
248248 /**
249249 * Creates a virtual scrolling mask to prevent touchmove, keyboard, scrollbar clicking,
250- * and wheel events
250+ * and wheel events.
251+ * @param {!Element|!angular.JQLite } elementToDisable
252+ * @param {Object= } scrollMaskOptions Object of options to modify functionality
253+ * - disableScrollMask Boolean of whether or not to create a scroll mask element or
254+ * use the passed parent element.
255+ * @returns {Function }
251256 */
252- function disableElementScroll ( element ) {
253- element = angular . element ( element || body ) ;
254-
257+ function disableElementScroll ( elementToDisable , scrollMaskOptions ) {
255258 var scrollMask ;
259+ var wrappedElementToDisable = angular . element ( elementToDisable || body ) ;
256260
257- if ( options . disableScrollMask ) {
258- scrollMask = element ;
261+ if ( scrollMaskOptions . disableScrollMask ) {
262+ scrollMask = wrappedElementToDisable ;
259263 } else {
260264 scrollMask = angular . element (
261265 '<div class="md-scroll-mask">' +
262266 ' <div class="md-scroll-mask-bar"></div>' +
263267 '</div>' ) ;
264- element . append ( scrollMask ) ;
268+ wrappedElementToDisable . append ( scrollMask ) ;
269+ }
270+
271+ function preventDefault ( e ) {
272+ e . preventDefault ( ) ;
265273 }
266274
267275 scrollMask . on ( 'wheel' , preventDefault ) ;
@@ -271,14 +279,10 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
271279 scrollMask . off ( 'wheel' ) ;
272280 scrollMask . off ( 'touchmove' ) ;
273281
274- if ( ! options . disableScrollMask && scrollMask [ 0 ] . parentNode ) {
282+ if ( ! scrollMaskOptions . disableScrollMask && scrollMask [ 0 ] . parentNode ) {
275283 scrollMask [ 0 ] . parentNode . removeChild ( scrollMask [ 0 ] ) ;
276284 }
277285 } ;
278-
279- function preventDefault ( e ) {
280- e . preventDefault ( ) ;
281- }
282286 }
283287
284288 // Converts the body to a position fixed block and translate it to the proper scroll position
0 commit comments