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

BUG: getNearestContentElement in $mdUtil always returns root #5609

Closed
hodeyp opened this issue Nov 7, 2015 · 8 comments
Closed

BUG: getNearestContentElement in $mdUtil always returns root #5609

hodeyp opened this issue Nov 7, 2015 · 8 comments
Assignees
Labels
pr: merge ready This PR is ready for a caretaker to review type: bug
Milestone

Comments

@hodeyp
Copy link

hodeyp commented Nov 7, 2015

I have a number of tooltips in a nested md-content, the positioning is incorrect when the nearest md-content is scrolled. The offending issue is getNearestContentElement in $mdUtil.

    getNearestContentElement: function (element) {
      var current = element.parent()[0];
      // Look for the nearest parent md-content, stopping at the rootElement.
      while (current && current !== $rootElement[0] && current !== document.body && current.nodeName !== 'MD-CONTENT {
        current = current.parentNode;
      }
      return current;
    },

as MD-CONTENT is caps, it never matches the nearest md-content

@Frank3K
Copy link
Contributor

Frank3K commented Nov 7, 2015

Isn't nodeName always in uppercase?

@hodeyp
Copy link
Author

hodeyp commented Nov 7, 2015

yes I believe it should be, however it is not working and when I change it in source to lower case it works correctly. Using latest Chrome build.

Looking at http://ejohn.org/blog/nodename-case-sensitivity/ it seems as if custom elements do not always follow the upper case rules.

@Frank3K
Copy link
Contributor

Frank3K commented Nov 7, 2015

Adding a toUpperCase() on the left side should solve that issue.

@ThomasBurleson ThomasBurleson modified the milestone: 1.0-rc5 Nov 16, 2015
EladBezalel added a commit that referenced this issue Nov 16, 2015
Custom elements do not always follow the upper case rules

http://ejohn.org/blog/nodename-case-sensitivity/

fixes #5609
@EladBezalel EladBezalel added type: bug pr: merge ready This PR is ready for a caretaker to review labels Nov 16, 2015
epelc referenced this issue Nov 20, 2015
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.
EladBezalel added a commit that referenced this issue Nov 23, 2015
Custom elements do not always follow the upper case rules

http://ejohn.org/blog/nodename-case-sensitivity/

fixes #5609
@epelc
Copy link
Contributor

epelc commented Nov 30, 2015

@EladBezalel This isn't working as expected. Replacing MD-CONTENT with md-content fixes it though. Doing this should also fix #5802

Tested in 1.0.0-rc5

@EladBezalel
Copy link
Member

@epelc thanks i will fix it.

@epelc
Copy link
Contributor

epelc commented Nov 30, 2015

Thanks

On Mon, Nov 30, 2015 at 4:27 PM, Elad Bezalel notifications@github.com
wrote:

@epelc https://github.com/epelc thanks i will fix it.


Reply to this email directly or view it on GitHub
#5609 (comment).

Thank you,
Ed Pelc

@EladBezalel
Copy link
Member

@epelc do you have any idea why .toUpperCase didn't made a difference ?

@epelc
Copy link
Contributor

epelc commented Nov 30, 2015

@EladBezalel I'm suspecting .toUpperCase converts md-content to Md-Content and does nothing if you input MD-CONTENT. Can you go on gitter I'd like to get this resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr: merge ready This PR is ready for a caretaker to review type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@ThomasBurleson @hodeyp @epelc @EladBezalel @Frank3K and others