array-reverse-polyfill
Advanced tools
Comparing version 1.0.7 to 1.0.8
19
index.js
(function() { | ||
var ua = navigator.userAgent; | ||
if (!ua.match(/(iPhone|iPad|iPod)/)) return; | ||
var matched = ua.match(/OS ([\d_\.]+) like Mac OS X/); | ||
if (!matched[1]) return; | ||
// Match all iOS 12, because we don't know the time when Apple fixed the bug. | ||
if (matched[1].indexOf('12') !== 0) return; | ||
if (typeof weex !== 'undefined') { // use in weex | ||
if (weex.config.env.osName !== 'iOS') return; | ||
if (weex.config.env.osVersion.indexOf('12') !== 0) return; | ||
} else { | ||
var ua = navigator.userAgent; | ||
if (!ua.match(/(iPhone|iPad|iPod)/)) return; | ||
var matched = ua.match(/OS ([\d_\.]+) like Mac OS X/); | ||
if (!matched || !matched[1]) return; | ||
// Match all iOS 12, because we don't know the time when Apple fixed the bug. | ||
if (matched[1].indexOf('12') !== 0) return; | ||
} | ||
Array.prototype._reverse = Array.prototype.reverse; | ||
Array.prototype.reverse = function reverse() { | ||
this.length = this.length; | ||
if (Array.isArray(this)) this.length = this.length; | ||
return Array.prototype._reverse.call(this); | ||
@@ -12,0 +17,0 @@ } |
{ | ||
"name": "array-reverse-polyfill", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Fix IOS 12 Array Reverse Bug.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,3 +11,3 @@ # array-reverse-polyfill | ||
```html | ||
<script src="//g.alicdn.com/mtb/fix-ios12-array/1.0.7/index.js"></script> | ||
<script src="//g.alicdn.com/mtb/fix-ios12-array/1.0.8/index.js"></script> | ||
``` | ||
@@ -14,0 +14,0 @@ |
4931
23