Closed ahdinosaur closed 10 years ago
what context and purpose does this serve on the server side?
the context is when you share code on the client and server and this code has calls to domready
in it, not that domready
is useful on the server but that it is coupled with other useful code. the purpose is to make domready
friendlier so as not to throw a Reference Error
when called on the server.
to be honest though, a better solution is to do the reverse if check in the shared code and not in domready
:
if (typeof document !== 'undefined') {
domready(function () {
Backbone.history.start() // or whatever
});
}
maybe this issue can be a guide to anyone who also runs into this error.
cheers! :)
No worries. My recommendation is to simply not even load this code on the server since it clearly isn't sharable. But don't get me wrong, I'm all for shareable libs, this just isn't one of them
hi! thanks for
domready
. :)in order to make it easier to share code on the client and server, it'd be nice if
domready
didn't error whenever called on the server.