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

Missing clientTop and clientLeft in elements #1089

Closed
konomae opened this issue Sep 23, 2023 · 0 comments · Fixed by #1090
Closed

Missing clientTop and clientLeft in elements #1089

konomae opened this issue Sep 23, 2023 · 0 comments · Fixed by #1090
Labels
bug Something isn't working

Comments

@konomae
Copy link
Contributor

konomae commented Sep 23, 2023

Describe the bug

Missing clientTop and clientLeft in elements.

clientWidth and clientHeight exist, but clientTop and clientLeft do not.

public readonly clientHeight = 0;
public readonly clientWidth = 0;

To Reproduce

Here's an example.
https://github.com/floating-ui/floating-ui/compare/master...konomae:floating-ui:happy-dom-repro?expand=1

  • Clone floating-ui repo
  • Change jsdom to happy-dom
  • Run tests

Since clientTop and clientLeft are missing, the calculation results in NaN.

stderr | index.test.tsx > floatingStyles no transform
Warning: `NaN` is an invalid value for the `left` css style property.
    at div
    at App (/Users/user/Code/floating-ui/packages/react-dom/test/index.test.tsx:680:60)

I made a small patch in the fork repo and re-run the tests, the calculation results are as expected.

Expected behavior

  • clientTop and clientLeft exist.
  • The calculation result should not be NaN

Additional context

JSDOM returns 0
https://github.com/jsdom/jsdom/blob/a39e0ec4ce9a8806692d986a7ed0cd565ec7498a/Changelog.md?plain=1#L730

@konomae konomae added the bug Something isn't working label Sep 23, 2023
konomae added a commit to konomae/happy-dom that referenced this issue Sep 23, 2023
capricorn86 added a commit that referenced this issue Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant