All Downloads are FREE. Search and download functionalities are using the official Maven repository.

polyfills.document.visibilityState.meta.json Maven / Gradle / Ivy

The newest version!
{"aliases":["default-3.3","default-3.4","default-3.5","default-3.6","default","caniuse:visib","caniuse:pagevisibility","modernizr:pagevisibility","PageVisibility"],"browsers":{"firefox":"10 - 17","safari":"4","android":"4.4 - *","opera":"15 - 19","chrome":"14 - 32"},"dependencies":["CustomEvent"],"docs":"https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API","spec":"http://www.w3.org/TR/page-visibility/","notes":["The alias `PageVisibility` works for this feature for backwards compatibility with the name under which it was previously (erroneously) available"],"detectSource":"'document' in this && 'hidden' in document && 'visibilityState' in document","testSource":"","baseDir":"document.visibilityState","hasTests":true,"testsSource":"/* eslint-env mocha, browser*/\n/* global proclaim, it */\n\nit('has a hidden property', function () {\n\tproclaim.notEqual(typeof document.hidden, 'undefined');\n});\n\nit('has a visibilityState property', function () {\n\tproclaim.notEqual(typeof document.visibilityState, 'undefined');\n});\n\n// Because some browsers will have unprefixed native support but will still support the prefixed version, this test will detect a prefix, and fire the event, but the polyfill isn't there so the prefixed version isn't re-fired as the unprefixed one. Therefore this test usefully tests that the polyfill works but can't be used because it will fail in a compliant native implementation. We really need to be able to programmatically trigger a change in page visibility, but I don't believe that's possible.\nit.skip('fires a normalized event name', function (done) {\n\tvar prefix = document.mozVisibilityState ? 'moz' : document.webkitVisibilityState ? 'webkit' : null;\n\tif (!prefix) {\n\t\treturn done();\n\t}\n\tdocument.addEventListener('visibilitychange', function (ev) {\n\t\tproclaim.equal('normalized event fired', 'normalized event fired');\n\t\tdone();\n\t});\n\n\tdocument.dispatchEvent(new Event(prefix + 'visibilitychange'));\n\tdone(new Error('Event not fired'))\n});"}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy