Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nuxodin/lazyfill
Polyfills on demand 💊
https://github.com/nuxodin/lazyfill
crossbrowser polyfill polyfill-service polyfills
Last synced: about 1 month ago
JSON representation
Polyfills on demand 💊
- Host: GitHub
- URL: https://github.com/nuxodin/lazyfill
- Owner: nuxodin
- License: mit
- Created: 2021-04-13T04:53:00.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-08T20:14:38.000Z (8 months ago)
- Last Synced: 2024-10-29T20:56:42.529Z (2 months ago)
- Topics: crossbrowser, polyfill, polyfill-service, polyfills
- Language: JavaScript
- Homepage:
- Size: 170 KB
- Stars: 63
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 💊 lazyfill
Polyfill Service - the lazy way
Polyfills **are loaded on demand**, only when they are needed 😲
Initial **3Kb** to polyfill a lot of Stuff!# Ussage
Add this script on the top of your page:
```html```
**done!**# Polyfills
(Anything missing? Any suggestions?)
- Window
- cookieStore
- fetch
- Promise
- IntersectionObserver
- ResizeObserver
- AbortController
- URLSearchParams
- Temporal
- temporal
- customElements
- structuredClone
- URLPattern
- ReadableStream
- Sanitizer
- requestIdleCallback
- cancelIdleCallback
- WeakSet
- cookieStore
- Element
- setHTML
- matches
- closest
- prepend
- append
- before
- after
- replaceWidth
- remove
- blur
- focus
- classList
- getElementsByClassName
- children
- toggleAttribute
- isVisible
- scrollIntoViewIfNeeded
- setHTML
- TypedArray
- toReversed
- toSorted
- with
- toReversed
- Array
- toReversed
- toSorted
- with
- toSpliced
- from
- of
- at
- copyWithin
- entries
- fill
- find
- findIndex
- findLast
- findLastIndex
- flat
- flatMap
- includes
- keys
- values
- toReversed
- Intl.DateTimeFormat
- formatToParts
- formatToParts
- Intl
- DisplayNames
- ListFormat
- Locale
- PluralRules
- RelativeTimeFormat
- getCanonicalLocales
- DisplayNames
- CSS
- escape
- registerProperty
- supports
- escape
- HTMLDocument
- currentScript
- caretRangeFromPoint
- currentScript
- Node
- contains
- isConnected
- contains
- HTMLElement
- inert
- inert
- HTMLFormElement
- reportValidity
- requestSubmit
- reportValidity
- HTMLInputElement
- reportValidity
- reportValidity
- HTMLSlotElement
- assignedElements
- assignedElements
- Math
- trunc
- sign
- trunc
- Navigator
- share
- share
- Number
- isInteger
- isInteger
- Object
- assign
- entries
- fromEntries
- is
- values
- hasOwn
- assign
- Promise
- allSettled
- any
- withResolvers
- allSettled
- RegExp
- flags
- flags
- String
- fromCodePoint
- at
- codePointAt
- endsWith
- includes
- padEnd
- padStart
- repeat
- startsWith
- replaceAll
- fromCodePoint
- SubmitEvent
- submitter
- submitter
- SVGStyleElement
- sheet
- sheet
- Crypto
- randomUUID
- randomUUID
- addEventListener signal options
- focus options
- classList force toggle
- Element.contains(TextNode) bug
# How it works
To every polyfillable property, the scripts adds a getter which **synchronously** loads the corresponding polyfill.
Of course, we all know that blocking xhr-requests is not nice.
Therefore, the url to the script that should be added to the page is given in the console.
Ideal for prototyping.
Let's assume that your browser does not support the function "String.prototype.at".
```js
> ['a','b','c'].at(-1); // accessing [].at immediately loads the polyfill
> 'c'
```
# Help
Any help is greatly appreciated.
# Thanks / Resources
https://github.com/es-shims
https://github.com/behnammodi/polyfill
https://polyfill.io/v3/
https://ungap.github.io/
https://github.com/Sylvain59650/all-polyfills
https://vanillajstoolkit.com/polyfills/