Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit d0b7bac

Browse files
committed
fix(tooltip): guard against missing offsetParent.
1 parent 992d9b5 commit d0b7bac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/tooltip/tooltip.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,13 @@ function MdTooltipDirective($timeout, $window, $$rAF, $document, $mdUtil, $mdThe
239239
var tipRect = $mdUtil.offsetRect(element, tooltipParent);
240240
var parentRect = $mdUtil.offsetRect(parent, tooltipParent);
241241
var newPosition = getPosition(scope.direction);
242+
var offsetParent = element.prop('offsetParent');
242243

243244
// If the user provided a direction, just nudge the tooltip onto the screen
244245
// Otherwise, recalculate based on 'top' since default is 'bottom'
245246
if (scope.direction) {
246247
newPosition = fitInParent(newPosition);
247-
} else if (newPosition.top > element.prop('offsetParent').scrollHeight - tipRect.height - TOOLTIP_WINDOW_EDGE_SPACE) {
248+
} else if (offsetParent && newPosition.top > offsetParent.scrollHeight - tipRect.height - TOOLTIP_WINDOW_EDGE_SPACE) {
248249
newPosition = fitInParent(getPosition('top'));
249250
}
250251

0 commit comments

Comments
 (0)