-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parentElement vs parentNode Tip #140
Comments
Thanks for the feedback. I'll update the content. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi and kudos for the great work!
I've noticed something odd on the page "parentElement vs parentNode".
Function distanceToTop in a Tip paragraph
actually isn't a correct way to calculate the distance to the top, since it uses offsetTop which basically works incrementally only when we're dealing with non-static elements or table layouts.
(also, even if it could work like that, the function reassigns ele to its parent before taking its own offset and doesn't take into account a border height)
A little example: https://codepen.io/Kindred-Spirit/pen/mdPRgJB
Maybe the tip needs to be updated on the limitations of this algorithm or deleted altogether since now the function is presented as a universal way to calculate the distance to the page top.
The text was updated successfully, but these errors were encountered: