Skip to content
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

Element.getBoundingClientRect() and Element.getClientRects() do not take scrolling into account. #9651

Open
peterjoel opened this issue Feb 15, 2016 · 2 comments
Labels

Comments

@peterjoel
Copy link
Contributor

@peterjoel peterjoel commented Feb 15, 2016

Related to #9650.
These rectangles should be translated by scrollTop and scrollLeft.

Spec: https://drafts.csswg.org/cssom-view/#dom-element-getclientrects

@jdm jdm added the A-content/dom label Feb 15, 2016
@jdm
Copy link
Member

@jdm jdm commented Feb 15, 2016

@peterjoel Can you link to the part of the specification that suggests that they should?

@peterjoel
Copy link
Contributor Author

@peterjoel peterjoel commented Feb 15, 2016

I was just going by the behaviour in Safari, Firefox and Chrome. The spec isn't incredibly clear, but it says:

Apply the transforms that apply to the element and its ancestors.

If you follow the link on "transforms" and keep following the linked documents to this, you find:

current transformation matrix (CTM)
A matrix that defines the mapping from the local coordinate system into the viewport coordinate system.

Which seems to suggest that the transformations are relative to the viewport, not the document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.