-
Notifications
You must be signed in to change notification settings - Fork 2
Using document.write #3
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
Comments
There are better solutions that don't involve |
I've done that. Seems legit. I don't do it anymore but whatevs. |
Interesting article update here -> https://developers.google.com/web/updates/2016/08/removing-document-write |
@felquis Note that this intervention only affects cross-origin scripts. Also, the |
@simevidas the intervention is currently on cross-origin scripts. But I can imagine in 2017 we expand and do an intervention on same-origin ones as well. script tags kinda suck, especially if they are under your control. if they're definitely under your control, then they should all have I would disagree with @bevacqua though. IMO polyfills should only be served if its neccessary. Ideally this means the bundles you ship down are customized to the UA. |
@paulirish I get it, but I would be lying if I said this intervention did not make me a little uneasy already and the idea of continuing to push it further more so. I'm sure there have been discussions involving my concerns already, and I'd probably feel better if I read through them but... I'm not sure where to find them? (Looking through the links from above announcement I see very little discussion about what breaks and how we know and what that means). |
@paulirish Absolutely, but I'd rather use the In this example, a |
@bkardell PS: @simevidas |
To comment on the original post (which I completely missed because for some reason github had not set me to watching my own repo... for months apparently): @simevidas no that seems pretty silly to me =) Shims like these are tiny, and are typically written in a way that makes sure they don't shim anything when the browser they're loaded in already supports the feature they're shimming. So in edge or chrome or firefox the shim will load, do nothing, and the browser moves on to the next shim. No need for a That said, the only reasonable place where you might conceivable stick one and get away with "yeah I know how document.write works, which is why it's here" is in the |
Uh oh!
There was an error while loading. Please reload this page.
This is a comment to http://pomax.github.io/1473270609919/if-you-use-use-document-write-you-suck-at-javascript
I have this HTML code at the bottom of my site:
So, I use
document.write
to synchronously insert a Promises polyfill only when the browser doesn’t support them natively (IE, etc.). What do you think of this pattern? Is it legit? 😋The text was updated successfully, but these errors were encountered: