Is it appropriate to access window instead of $(window) when jQuery is used? -


in jquery based code have several places window object accessed directly. acceptable practice or there drawbacks of such approach?

i thought $(window) 1:1 replacement window, not. example "onhashchange" in window works, "onhashchange" in $(window) not.

other constructs access window are: window.location, window.open, window.settimeout. better find , use jquery based replacements of them?

there's no problem accessing window-object directly. jquery should used tool helps in client-side development. if correct api available natively, means use it. in cases, native api's faster (although differences negligible).

if want promoto consistency following access underlying window object:

$(window)[0].onhashchange = ... 

but in opinion it's easier access window directly.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -