-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Featuretest pagevisibility #700
Conversation
@@ -0,0 +1,12 @@ | |||
Modernizr.addTest('pagevisibility', function(){ | |||
for(var i = 0, len = Modernizr._domPrefixes.length; i < len; ++i) { | |||
if(typeof document[Modernizr._domPrefixes[i].toLowerCase() + "Hidden"] !== "undefined") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add one of these before this:
var prefix = Modernizr._domPrefixes[i].toLowerCase();
it'll look a lot better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (
thanks. was just talking to @ebidel about how we didnt have this, surprisingly. |
Could you quickly test in ie8 too? |
@@ -0,0 +1,12 @@ | |||
Modernizr.addTest('pagevisibility', function(){ | |||
for(var i = 0, len = Modernizr._domPrefixes.length; i < len; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (
and single-quotes |
added your change requests. test on IE8 works fine. |
Doh! Just wrote one myself, didn't realize I was duplicating effort. |
is something still missing? |
yeah that slice of pie you promised to get me to accept your PR instead of |
// http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html | ||
|
||
Modernizr.addTest('pagevisibility', function(){ | ||
for (var i = 0, len = Modernizr._domPrefixes.length; i < len; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that it makes a difference, but i++
is clearer.
Paul, the cake is a lie, but here you go :)
|
made ++i to i++ |
@sindresorhus test is now using I think |
@helgri if you do |
@ryanseddon Oh, that's really convenient... |
@helgri looks good can you squash your commits into one please. If you're not sure how to do that check out this post on commit squashing |
squashed like hell :) |
Feature detect for Page Visibility API
Thanks @helgri 👍 |
Feature detect for Page Visibility API
Added simple test for PageVisibility API support
Tested w/ Chrome Canary, FIrefox 15, Safari 6, IE9/10