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

fix chrome warning #826

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

fix chrome warning #826

wants to merge 2 commits into from

Conversation

ben8p
Copy link

@ben8p ben8p commented Jan 29, 2014

When documentElement.scrollTop is 0

Benjamin Santalucia added 2 commits January 29, 2014 11:11
When documentElement.scrollTop is 0
@cameronjacobson
Copy link

Are there specific scenarios, environments, or versions where this is happening? When I isolate the code, and run the following from Chrome's console:

document.documentElement.scrollTop || document.body.scrollTop
//  - or -
document.body.scrollTop || document.documentElement.scrollTop
//  - or -
document.documentElement.scrollLeft || document.body.scrollLeft
//  - or -
document.body.scrollLeft || document.documentElement.scrollLeft

I get expected results. A 'number' type. And when the page is scrolled to the top / left I get 0.

@ben8p
Copy link
Author

ben8p commented Mar 12, 2015

With the original code, if
document.documentElement.scrollTop returns 0 then document.body.scrollTop
will be evaluated but in strict mode it is deprecared. Thus Chrome send a
warning.
The test prevent the warning.

Le jeu 12 mars 2015 20:41, Cameron Jacobson [email protected] a
écrit :

Are there specific scenarios, environments, or versions where this is

happening? When I isolate the code, and run the following from Chrome's
console:

document.documentElement.scrollTop || document.body.scrollTop
// - or -
document.body.scrollTop || document.documentElement.scrollTop
// - or -
document.documentElement.scrollLeft || document.body.scrollLeft
// - or -
document.body.scrollLeft || document.documentElement.scrollLeft

I get expected results. A 'number' type. And when the page is scrolled to
the top / left I get 0.


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

@cameronjacobson
Copy link

I was able to find several threads / discussions about this. While reading through a lot of them, I found the following thread which appears to explain things more thoroughly.

https://code.google.com/p/chromium/issues/detail?id=342307

Part of the way down the thread [comment number 6] someone mentions that they have in fact removed the warning. This was based on a search on GitHub that indicated the issue is less prevalent now than when they originally placed the warning.

There is also mention [comment number 4] that the existing code in raphaeljs works cross-browser. I don't know if this means it will in fact eventually be deprecated, but my hunch is it would not be recommended if this was the case. That individual is using a samsung.com email, but scrolling further [comment number 6] does indicate that they "do not work for Google, ... but are contributor to Blink".

That was as authoritative an answer as I was able to find.

@tomasAlabes
Copy link
Collaborator

Any update on this? Seems an old inconvenience in Chrome

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

Successfully merging this pull request may close these issues.

3 participants