Comments (8)
The polyfill should not be used to check url errors. It's light and because of it, it can't check every patterns. For a full implementation but bigger: https://github.com/lifaon74/whatwg-url
from url-polyfill.
The polyfill should not be used to check url errors
It is expected that the URL polyfill will behave in the same way as the native URL.
from url-polyfill.
Not possible: the full implementation is probably near the megabyte ! This is because of the support of punycodes, parser, unicode chars, etc... such a big polyfill is not recommended for user with limited bandwidth. Instead this polyfill covers 95%~99% of the specs which doesn't require long code.
As long as the url is correct, the parser will work as expected BUT in case of special url (unicode chars, malformed, etc..) the polyfill may be incorrect: Because of this, the polyfill SHOULD NOT be used to check if an url is fully correct or not (because there will always be a case where an url (provided by the client) is not compliant. So its unsafe !). For this, use on backend the whatwg-url instead.
from url-polyfill.
Thanks.
from url-polyfill.
@lifaon74 the main problem only in support custom encoding in search query params and malformed unicode character. core-js
URL
implementation is almost full and takes just some kilobytes.
from url-polyfill.
The core-js url implementation is in the range of 50KB (non gziped) but requires a lot of dependencies to work properly which increases the bundle size. This polyfill (url-polyfill) is arround 13KB (non gziped) and requires no dependencies at all. Moreover, this repo was done before any implementation of URL by core-js.
Of course, now, it may be more interesting to use core-js... It only depends of your needs.
from url-polyfill.
The core-js url implementation is in the range of 50KB (non gziped)
Minified, without gzip and the rest parts of core-js
, it takes ~17kb.
You are right, my comment was related just to "not possible" and the reasons. But sure, this more simple polyfill make sense for some cases.
from url-polyfill.
More other, your issue was one the reasons for adding URL
polyfill to core-js
-)
from url-polyfill.
Related Issues (20)
- Error parsing params values with = HOT 1
- Constructor should throw when no base is given for relative URLs HOT 1
- Creating `new URLSearchParams()` throws error in ie11 HOT 2
- Polyfill broken in V1.1.X HOT 6
- 【feature-umd bundle】 Support import instead of changing global objects HOT 1
- URLSearchParams and URL referenced globally instead of as properties of 'global' parameter HOT 2
- TypeError: Cannot read property 'apply' of undefined HOT 6
- [Question]What's the difference between this repo and ... HOT 1
- Failed to create URL with base address contained port 80 HOT 2
- Tag releases HOT 2
- URLSearchParams with multiple question marks not parsed correctly HOT 1
- Construction using window.location.href as base throws Invalid URL HOT 5
- Add tests for #54
- "Invalid Argument" on "new URLSearchParams(formData.entries())" in Edge 44.18362.449.0 HOT 3
- not working in nativescript
- URLSearchParams entries not supported on some versions of firefox HOT 4
- 'base' argument is not stringified HOT 1
- 'URLSearchParams' is undefined (Edge 14-16)
- IE11 object missing most fields HOT 4
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 url-polyfill.