Skip to content

Commit

Permalink
Moving geolocation test to feature-detects/geolocation.js
Browse files Browse the repository at this point in the history
  • Loading branch information
rupl committed Sep 21, 2012
1 parent d3f7b6f commit 9c2a235
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
12 changes: 12 additions & 0 deletions feature-detects/geolocation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

// geolocation is often considered a trivial feature detect...
// Turns out, it's quite tricky to get right:
//
// Using !!navigator.geolocation does two things we don't want. It:
// 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513
// 2. Disables page caching in WebKit: webk.it/43956
//
// Meanwhile, in Firefox < 8, an about:config setting could expose
// a false positive that would throw an exception: bugzil.la/688158

Modernizr.addTest('geolocation', Modernizr.geolocation = 'geolocation' in navigator);
15 changes: 0 additions & 15 deletions modernizr.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,21 +400,6 @@ window.Modernizr = (function( window, document, undefined ) {
* -----
*/

// geolocation is often considered a trivial feature detect...
// Turns out, it's quite tricky to get right:
//
// Using !!navigator.geolocation does two things we don't want. It:
// 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513
// 2. Disables page caching in WebKit: webk.it/43956
//
// Meanwhile, in Firefox < 8, an about:config setting could expose
// a false positive that would throw an exception: bugzil.la/688158

tests['geolocation'] = function() {
return 'geolocation' in navigator;
};


tests['postmessage'] = function() {
return !!window.postMessage;
};
Expand Down

0 comments on commit 9c2a235

Please sign in to comment.