Conversation
Fixes two compatibility issues:
1. Inside wrapped browserify modules, `this` does not refer to `window`,
it's the `exports` object. Since it doesn't really make sense to use
this plugin in environments that don't have a window.navigator object,
the code now just references 'window' directly.
2. The plugin did a global export if AMD wasn't detected, which assumed
there was a global jQuery object. The added `module.exports`-detection
uses `require` to pull in jQuery instead.
|
Have you successfully tested this in AMD and Node/Browerify environments and ensured the tests still pass? |
|
I've tested the changes in a project using browserify 7.0.1 and jQuery 1.11.2. The tests pass now after 4ad34a3.
I don't have any AMD project/setup to test these changes with, but I assume it'll work identical to before because the |
dist/jquery.browser.js
Outdated
There was a problem hiding this comment.
I'd rather this written right after the comment at the top (line 15, with a blank line after it and before (function...).
There was a problem hiding this comment.
I'd rather this written right after the comment at the top (line 15, with a blank line after it and before (function...).
Done so.
|
Just that one minor nit and this should be fine. |
|
Thanks for the contribution! |
|
I've added simple RequireJs testing on 3f6c1da |
Fixes two compatibility issues:
thisdoes not refer towindow,it's the
exportsobject. Since it doesn't really make sense to usethis plugin in environments that don't have a window.navigator object,
the code now just references 'window' directly.
there was a global jQuery object. The added
module.exports-detectionuses
requireto pull in jQuery instead.