javascript - window.pageYOffset or just pageYOffset? / X + IEnumber+ pageYOffset / X support? -


1) i've noticed (at least in chrome) there no difference in output of these two:

pageyoffset; window.pageyoffset; 

they both access same global return same - difference between these calls , better use?

my current suspicion: suspect look-for-variables implementation, idea window.pageyoffset direct access window object pageyoffset property whereas runing pageyoffset "slowly" every scope deep top , finaly finds in (super)global scope. think? did make tests?

2) ienumber+ supports window.pageyoffset / or pageyoffset ?
2) answer: mdn says ie<9 doesnt support those, answer 2) problably ie9+ (no surprise)

        source: @blender & https://developer.mozilla.org/en-us/docs/web/api/window.scrolly

using window. prefix faster because, mentioned, there no lookup. won't mess if define local variable called 'pageyoffset' because still @ window.pageyoffset.

i because it's more explicit , there less confusion.

edit: difference lookup, obviously.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -