url-search-params-polyfill
Advanced tools
Comparing version 2.0.2 to 2.0.3
10
index.js
@@ -14,2 +14,4 @@ /** | ||
isSupportObjectConstructor = nativeURLSearchParams && (new nativeURLSearchParams({a: 1})).toString() === 'a=1', | ||
// There is a bug in safari 10.1 (and earlier) that incorrectly decodes `%2B` as an empty space and not a plus. | ||
decodesPlusesCorrectly = nativeURLSearchParams && (new nativeURLSearchParams('s=%2B').get('s') === '+'), | ||
__URLSearchParams__ = "__URLSearchParams__", | ||
@@ -19,3 +21,3 @@ prototype = URLSearchParamsPolyfill.prototype, | ||
if (nativeURLSearchParams && isSupportObjectConstructor) { | ||
if (nativeURLSearchParams && isSupportObjectConstructor && decodesPlusesCorrectly) { | ||
return; | ||
@@ -123,7 +125,9 @@ } | ||
// There is a bug in Safari 10.1 and `Proxy`ing it is not enough. | ||
var forSureUsePolyfill = !decodesPlusesCorrectly; | ||
var useProxy = (!forSureUsePolyfill && nativeURLSearchParams && !isSupportObjectConstructor && self.Proxy) | ||
/* | ||
* Apply polifill to global object and append other prototype into it | ||
*/ | ||
self.URLSearchParams = (nativeURLSearchParams && !isSupportObjectConstructor && self.Proxy) ? | ||
self.URLSearchParams = useProxy ? | ||
// Safari 10.0 doesn't support Proxy, so it won't extend URLSearchParams on safari 10.0 | ||
@@ -130,0 +134,0 @@ new Proxy(nativeURLSearchParams, { |
{ | ||
"name": "url-search-params-polyfill", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "a simple polyfill for javascript URLSearchParams", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/jerrybendy/url-search-params-polyfill", |
@@ -148,3 +148,3 @@ # URLSearchParams polyfill [![](https://img.shields.io/npm/v/url-search-params-polyfill.svg)](https://www.npmjs.com/package/url-search-params-polyfill) | ||
| Edge | Chrome | Opera | Sumsung Internet | QQ | Baidu | | ||
| Edge | Chrome | Opera | Samsung Internet | QQ | Baidu | | ||
| --- | --- | --- | --- | --- | --- | | ||
@@ -151,0 +151,0 @@ | 14 - 16 | 40 - 48 | 27 - 35 | 4 | 1.2 | 7.12 | |
@@ -256,6 +256,7 @@ /** | ||
c: 'http://a.com/?c=7&d=8#!/asd', | ||
d: 'hello world' | ||
d: 'hello world', | ||
e: '+' | ||
}; | ||
var testStr = 'a=%E4%BD%A0%E5%A5%BD&b=%3Cscript%3E&c=http%3A%2F%2Fa.com%2F%3Fc%3D7%26d%3D8%23%21%2Fasd&d=hello+world'; | ||
var testStr = 'a=%E4%BD%A0%E5%A5%BD&b=%3Cscript%3E&c=http%3A%2F%2Fa.com%2F%3Fc%3D7%26d%3D8%23%21%2Fasd&d=hello+world&e=%2B'; | ||
@@ -262,0 +263,0 @@ it('URL encode', function () { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25753
631