Where would we be without my favorite flavor of logic?

This commit is contained in:
Zixaphir 2013-03-19 09:50:43 -07:00
parent b88ad38104
commit a5fb6e26db
2 changed files with 7 additions and 11 deletions

View File

@ -1112,11 +1112,7 @@
if ('visibilityState' in document) { if ('visibilityState' in document) {
return; return;
} }
if ('webkitVisibilityState' in document) { if (!(prefix = ('webkitVisibilityState' in document ? 'webkit' : 'mozVisibilityState' in document ? 'moz' : void 0))) {
prefix = 'webkit';
} else if ('mozVisibilityState' in document) {
prefix = 'moz';
} else {
return; return;
} }
property = prefix + 'VisibilityState'; property = prefix + 'VisibilityState';

View File

@ -4,12 +4,12 @@ Polyfill =
visibility: -> visibility: ->
# page visibility API # page visibility API
return if 'visibilityState' of document return if 'visibilityState' of document
if 'webkitVisibilityState' of document return unless prefix = (
prefix = 'webkit' if 'webkitVisibilityState' of document
else if 'mozVisibilityState' of document 'webkit'
prefix = 'moz' else if 'mozVisibilityState' of document
else 'moz'
return )
property = prefix + 'VisibilityState' property = prefix + 'VisibilityState'
event = prefix + 'visibilitychange' event = prefix + 'visibilitychange'