Merged
Conversation
…orrect identification of all Blackberry and Kindle browers
Support iOS, Kindle and BlackBerry Mobile Devices
Update version to v0.0.7
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.
Support for node/browserify
I've chosen `jQBrowser()` as this is the jQuery.browser plugin, and because I cannot think of an uncommon but descriptive name for it, for I do not want to pollute the common namespace.
By optionally going jQuery free, this allows a new use-case: detecting a browser from an arbitrary UA. However, because the majority of cases will involve detecting the current browser, default to the UA if the function is called without passing parameters. When using jQuery, the UA is always provided.
This required a tad bit of restructuring, mainly making the browser matching a part of the function and not outside of it. This also prevents the code from running twice if jQuery is loaded and the function is called. It may be that we want the function to be called on page load regardless. In that case, the changes required are trivial.
add the `uaMatch` function to the returned object for use if desired
Added 'require' to the require test so you can differentiate with other tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.