From f62f6934c02f4c994f3e9a9157cc0de351dd8c79 Mon Sep 17 00:00:00 2001 From: Kate Rachwal Date: Wed, 14 Oct 2015 11:07:39 -0400 Subject: [PATCH] fix(tooltip): corrected md-tooltip positioning when scrolled There are several issues out there (e.g. #2406) that point to tooltip positioning when the page is scrolled and getNearestContentElement that suggests that the enclosed loop is supposed to stop at md-content but does not. Adding that condition to the loop fixed the positioning issue for me. Fixes #2406. Closes #5161. --- src/components/tooltip/tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/tooltip/tooltip.js b/src/components/tooltip/tooltip.js index 4eeae383462..696008a92ee 100644 --- a/src/components/tooltip/tooltip.js +++ b/src/components/tooltip/tooltip.js @@ -118,7 +118,7 @@ function MdTooltipDirective($timeout, $window, $$rAF, $document, $mdUtil, $mdThe function getNearestContentElement () { var current = element.parent()[0]; // Look for the nearest parent md-content, stopping at the rootElement. - while (current && current !== $rootElement[0] && current !== document.body) { + while (current && current !== $rootElement[0] && current !== document.body && current.nodeName !== 'MD-CONTENT') { current = current.parentNode; } return current;