Skip to content

Commit

Permalink
Merge pull request #211 from github/ensure-htmlelement-exists
Browse files Browse the repository at this point in the history
Ensure HTMLElement exists in all contexts
  • Loading branch information
keithamus authored Nov 23, 2022
2 parents c8cd45f + b604b5c commit 5ff8819
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/relative-time-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {DateTimeFormat as DateTimeFormatPonyFill} from './datetimeformat-ponyfil
import {RelativeTimeFormat as RelativeTimeFormatPonyfill} from './relative-time-ponyfill.js'
import {isDuration, withinDuration} from './duration.js'
import {strftime} from './strftime.js'
const root = (typeof globalThis !== 'undefined' ? globalThis : window) as typeof window
const HTMLElement = root.HTMLElement || (null as unknown as typeof window['HTMLElement'])

const supportsIntlDatetime = typeof Intl !== 'undefined' && 'DateTimeFormat' in Intl
const DateTimeFormat = supportsIntlDatetime ? Intl.DateTimeFormat : DateTimeFormatPonyFill
Expand Down

0 comments on commit 5ff8819

Please sign in to comment.