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

Dummy documentElement.clientTop and clientLeft #980

Closed
denis-sokolov opened this issue Dec 15, 2014 · 5 comments
Closed

Dummy documentElement.clientTop and clientLeft #980

denis-sokolov opened this issue Dec 15, 2014 · 5 comments

Comments

@denis-sokolov
Copy link

In light of #689, perhaps we could add dummy clientTop and clientLeft on the document.documentElement?
For example, jQuery .offset uses thoses.
Could we just hardcode those to zeros for now?

@domenic
Copy link
Member

domenic commented Dec 15, 2014

Are they always zero in browsers?

@denis-sokolov
Copy link
Author

No, in my experience they always equal to the width of the border on the <html> element.
This observation agrees with MDN.

@domenic
Copy link
Member

domenic commented Dec 15, 2014

In that case I don't think we should do this. undefined converts to zero, and I don't really think #689 was a good idea in retrospect anyway.

@denis-sokolov
Copy link
Author

I actually make use of #689. undefined does not convert to zero in operations. 5 + undefined becomes NaN and that's not particularly useful. It's not hard for me to stub it out in client code either.

I think you need to decide on a general rule - what does jsdom do when asked for unsupported functionality. Throw, return undefined/NaN, or return some zero-ish values.
Consider that it's not only #689. innerWidth, innerHeight and others are stubbed out with some zero-ish values. (1024 is meaninglessly zero-ish for jsdom)

@domenic
Copy link
Member

domenic commented Dec 22, 2014

We could just get the computed border width and use that. There's no reason to get a dummy value if we can get the real values instead.

@domenic domenic closed this as completed in e101df2 Feb 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants