Skip to content

Commit

Permalink
Merge pull request #51 from keithamus/remove-a-whole-bunch-of-polyfills
Browse files Browse the repository at this point in the history
Remove a whole bunch of polyfills
  • Loading branch information
keithamus committed Jan 29, 2024
2 parents 58753f3 + bc9b816 commit 78aeb4e
Show file tree
Hide file tree
Showing 18 changed files with 140 additions and 880 deletions.
470 changes: 130 additions & 340 deletions docs/index.html

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions src/abortsignal-abort.ts

This file was deleted.

26 changes: 0 additions & 26 deletions src/array-findlast.ts

This file was deleted.

31 changes: 0 additions & 31 deletions src/array-findlastindex.ts

This file was deleted.

40 changes: 0 additions & 40 deletions src/arraylike-at.ts

This file was deleted.

33 changes: 0 additions & 33 deletions src/crypto-randomuuid.ts

This file was deleted.

48 changes: 0 additions & 48 deletions src/event-abortsignal.ts

This file was deleted.

32 changes: 0 additions & 32 deletions src/form-requestsubmit.ts

This file was deleted.

47 changes: 10 additions & 37 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
import * as abortSignalAbort from './abortsignal-abort.js'
import * as abortSignalTimeout from './abortsignal-timeout.js'
import * as arrayAt from './arraylike-at.js'
import * as clipboardItem from './clipboarditem.js'
import * as cryptoRandomUUID from './crypto-randomuuid.js'
import * as elementCheckVisibility from './element-checkvisibility.js'
import * as eventAbortSignal from './event-abortsignal.js'
import * as navigatorClipboard from './navigator-clipboard.js'
import * as formRequestSubmit from './form-requestsubmit.js'
import * as objectHasOwn from './object-hasown.js'
import * as requestIdleCallback from './requestidlecallback.js'
import * as arrayFindLast from './array-findlast.js'
import * as arrayFindLastIndex from './array-findlastindex.js'

export const baseSupport =
typeof Blob === 'function' &&
typeof PerformanceObserver === 'function' &&
typeof Intl === 'object' &&
typeof MutationObserver === 'function' &&
typeof URLSearchParams === 'function' &&
typeof WebSocket === 'function' &&
typeof IntersectionObserver === 'function' &&
typeof queueMicrotask === 'function' &&
typeof TextEncoder === 'function' &&
typeof TextDecoder === 'function' &&
typeof customElements === 'object' &&
typeof HTMLDetailsElement === 'function' &&
typeof AbortController === 'function' &&
typeof AbortSignal === 'function' &&
typeof globalThis === 'object' &&
'entries' in FormData.prototype &&
'toggleAttribute' in Element.prototype &&
// ES2019
'fromEntries' in Object &&
'flatMap' in Array.prototype &&
Expand All @@ -41,32 +17,29 @@ export const baseSupport =
'replaceAll' in String.prototype &&
'any' in Promise &&
// ES2022
// 'at' in String.prototype && // Polyfilled
// 'at' in Array.prototype && // Polyfilled
// 'hasOwn' in Object && // Polyfilled
'at' in String.prototype &&
'at' in Array.prototype &&
'hasOwn' in Object &&
// ESNext
// 'abort' in AbortSignal && // Polyfilled
'abort' in AbortSignal &&
// 'timeout' in AbortSignal && // Polyfilled
// DOM / HTML and other specs
typeof queueMicrotask === 'function' &&
typeof HTMLDialogElement === 'function' &&
typeof AggregateError === 'function' &&
// 'randomUUID' in crypto && // Polyfilled
typeof BroadcastChannel === 'function' &&
'randomUUID' in crypto &&
'replaceChildren' in Element.prototype &&
'requestSubmit' in HTMLFormElement.prototype &&
// 'requestIdleCallback' in window && // Polyfilled
true

export const polyfills = {
abortSignalAbort,
abortSignalTimeout,
arrayAt,
clipboardItem,
cryptoRandomUUID,
elementCheckVisibility,
eventAbortSignal,
navigatorClipboard,
formRequestSubmit,
objectHasOwn,
requestIdleCallback,
arrayFindLast,
arrayFindLastIndex,
}

export function isSupported() {
Expand Down
33 changes: 0 additions & 33 deletions src/object-hasown.ts

This file was deleted.

24 changes: 0 additions & 24 deletions test/abortsignal-abort.js

This file was deleted.

Loading

0 comments on commit 78aeb4e

Please sign in to comment.