-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fallback API needs setters as well as getters #4
Comments
Do you have a specific version where this breaks for a support comment, and can you make a pull request adding two |
Using browserstack I was able to get it to happen on Safari 5.1 - I didn't test any other versions. I didn't use noop in my fix, I added actual setters diff -r e71402529c71 -r 25f8f99f4a29 assets-src/js/jquery.pagevisibility.js
--- a/assets-src/js/jquery.pagevisibility.js Mon Apr 06 15:45:06 2015 -0500
+++ b/assets-src/js/jquery.pagevisibility.js Tue Apr 07 10:50:28 2015 -0500
@@ -40,12 +40,18 @@
defineProp( document, "hidden", {
get: function() {
return polyfillHidden;
+ },
+ set: function(value) {
+ polyfillHidden = value;
}
});
defineProp( document, "visibilityState", {
get: function() {
return visibilityState;
+ },
+ set: function(value) {
+ visibilityState = value;
}
});
} I don't have the time to submit a PR at the moment, so I'm hoping posting a diff would suffice. If not, let me know, and I can get to it later in the day |
Would certainly be appreciated, but I can get to it later this week if time is a concern. The setters should definitely be no-op rather than actual setters in order to match what the actual API is; you can't change |
Ah, I see this in the comment right below. // In browsers that support Object.defineProperty,
// setting the two properties on document is essentially a no-op.
// In other older browsers, this is how we'll keep the properties in sync,
// although it's more prone to tampering than with Object.defineProperty. I'll make the change later on an retest to ensure it's still okay with $.noop |
The defineProp calls for document.hidden and document.visibilityState only contain getters. In older versions of safari this causes the subsequent sets of these properties to error with the message "TypeError: setting a property that has only a getter"
The text was updated successfully, but these errors were encountered: