Comments (14)
I've used both of the above polyfills/shims in production. I think mine and evilmartians both need more/tests, but they do the trick. I would say 'use with polyfills'.
from html5please.
Defiantly worth mentioning. Neiter appear to be polyfills they are just feature equivelant emulation using propietory APIs.
Writing a real polyfill shouldn't be too difficult though.
from html5please.
If this is proprietary API I think we should mention with 'avoid'. We shouldnt have to face the trauma of flexbox again.
from html5please.
That's not what I meant. I meant the polyfills don't use the native API. (the polyfills use their own propietory API, except the term "propietory API" is poorly used to describe that).
Page Visibility is a proper w3c specification.
from html5please.
ohh i see. perhaps then we need a good polyfill that DOES use the native API?
from html5please.
So, to add some further clarity to the comment from @Raynos, both solutions do use the Page Visibility API in it's native form if it's present, but do so and provide fallbacks through an abstraction layer. This was necessary as we were experiencing (IE) issues related to just firing off simulated 'visibilityChanged' events that prevented us from just doing a 100% polyfill. If anyone feels they can improve on that, by all means please do :)
from html5please.
Would firing visibilityChanged events through an emulated DOM2 events (addEventListener
) API in oldIE count as a 100% polyfill? That should be possible. Also DOM 0 event listeners like document.onvisibilitychange
should also be possible.
I'll add writing a page visibility polyfill to the list.
from html5please.
It would cover the most important part of the spec, but if you're going for completeness there's a little more to it such as exposing the actual state and not just that it's changed :)
On 24 Jan 2012, at 18:54, [email protected] wrote:
Would firing visibilityChanged events through an emulated DOM2 events (
addEventListener
) API in oldIE count as a 100% polyfill? That should be possible. Also DOM 0 event listeners likedocument.onvisibilitychange
should also be possible.I'll add writing a page visibility polyfill to the list.
Reply to this email directly or view it on GitHub:
#87 (comment)
from html5please.
The following polyfill : https://gist.github.com/1677020 given some polish and testing should work correctly.
Note that legacy browser support in this case requires polyfilling addEventListener
, [].forEach
and Object.defineProperty
which should all be shimmable back to oldIE.
from html5please.
If it helps make things feel more native in old ie, you could use a combination onpropertychange and toString = function() to make your polyfill act and feel more native (i use it as a poor man's object.watch)
from html5please.
@Raynos that works for me, thank you thank you!
from html5please.
@Raynos what is your view on this? Would you be up to making a new post on Visibility API?
from html5please.
Its worth mentioning yes, not sure what I would write about it, may get around to it.
from html5please.
Do you guys think there's still a need for 'use with polyfill'? Take a look at the caniuse page, but looks like it's overall quite green.
from html5please.
Related Issues (20)
- Polyfills for @supports
- HTTPS please HOT 2
- Mid 2019 refreshment HOT 5
- Update @font-face
- Enable building PRs via netlify to preview Changes in the browser HOT 2
- Update box-shadow
- Update border-radius
- Update background-image options
- Update iframe-seamless
- Add fit-content
- Replace favicon
- Favicon is not loading: HOT 2
- update google analytics script HOT 3
- Remove IE6 and IE7 info HOT 7
- Fix/remove broken links
- Add a canonical URL
- Remove minmaxwh ? HOT 3
- Show moreurl and caniuse link together HOT 1
- The CSS for the site isn't minified
- The JS for the site isn't minified HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html5please.