expressjs / express-expose

Expose raw js, objects, and functions to the client-side (awesome for sharing utils, settings, current user data etc)
MIT License
299 stars 26 forks source link

IE8 Bug #13

Closed arlolra closed 12 years ago

arlolra commented 12 years ago

For some odd reason, IE8 isn't happy with this: https://github.com/visionmedia/express-expose/blob/master/lib/express-expose.js#L218

var test = test || {}; causes a problem. I'm guessing it has something to do with hoisting replacing the global variable.

In any case, swapping this,

return (i ? '' : 'var ') + part + ' = ' + part + ' || {};';

with this,

return (i ? '' : 'window.') + part + ' = window.' + part + ' || {};';

gets around the problem. Not sure you want to do that, just thought I'd point it out.

tj commented 12 years ago

crap yeah that's a bug on my part

arlolra commented 12 years ago

want me to turn it into a pull request?

tj commented 12 years ago

sure! that would be great