Why were window.scrollY and window.scrollX introduced?

Knu picture Knu · Sep 25, 2010 · Viewed 17.2k times · Source

As far as I know, pageXOffset/pageYOffset properties were already available since Netscape 4 era.
And it seems scrollX/scrollY were introduced circa Netscape 6.

Alternative question:

Q2. Is there a browser which implements scrollX/scrollY but doesn't support pageXOffset/pageYOffset?

I will add a third question because no one was able to answer the previous ones:

Q3. scrollX/scrollY was added to the latest editor's draft of the CCSOM and the working draft only got pageXOffset/pageYOffset, why are they keeping both attributes?

Answer

gblazex picture gblazex · Nov 5, 2010

Is there a browser which implements scrollY/X but doesn't support pageY/XOffset

I guess what you want to know is whether you can fully trust pageY/XOffset and leave scrollY/X out of the game. The answer is yes. pageY/XOffset is working in Firefox, Chrome, Opera, and IE 9!

I can't test scrollX/Y on IE9 currently, but it is not listed on MSDN properties so there is a good chance it answers your question. So there may be browsers implementing pageY/XOffset but not scrollY/X.

Why were window.scrollY and window.scrollX introduced?

As scrollY is only an alias, I'm sure it is only for better readability.