Open terion-name opened 6 years ago
What version of Safari are you seeing this in? I was trying Safari 9 via BrowserStack and was not able to reproduce the problem.
If you're able to come up with an alternate test I can replace what's there:
if (!('head' in document))
document.head = document.getElementsByTagName('head')[0];
You could try if (typeof document.head !== 'object')
What version of Safari are you seeing this in?
Mobile safari on iOS9, that is written in issue. You can't change it's version in iOS
While this is really strange, because calling this from console does not triggers an error. But in real app it fails. Maybe polyfill is loading before document.head is ready to use? Sort of document loading lifecycle...
I'm having no luck reproducing on iOS9 / Safari 9.0.1. Can you please provide a link to a page demonstrating the problem? Or can you attempt to minimize the repro?
For example, the following runs without error on iOS9 (via BrowserStack):
<script>
if (!('head' in document)) {
document.write('adding head');
document.head = document.getElementsByTagName('head')[0];
}
document.write('ok: ' + navigator.userAgent);
</script>
Note that "adding head" isn't written, so the !('head' in document)
test is returning false. Somehow in your configuration that test must be returning true, indicating there's either some behavior difference in the BrowserStack virtual machine configuration or that your app has some other script modifying the state of things, or... something else.
Ping - any luck producing a stand-alone repro?
https://github.com/inexorabletash/polyfill/blob/5f8bc4cacfb8d7bf2761c7ad0bd69c53ad49c54d/html.js#L17
this breaks mobile safari in ios9 with
trying to set read-only property