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
Post a Comment