Skip to content

Commit

Permalink
fix: Move 'noTitle' conditional.
Browse files Browse the repository at this point in the history
Calculate the new title, just don’t update the attribute. This change means the 'relative-time-updated' event will fire even if 'noTitle' is set.
  • Loading branch information
smockle authored May 31, 2024
1 parent 534ce30 commit 257f0eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/relative-time-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,9 @@ export class RelativeTimeElement extends HTMLElement implements Intl.DateTimeFor
return
}
const now = Date.now()
if (!this.#customTitle && !this.noTitle) {
if (!this.#customTitle) {
newTitle = this.#getFormattedTitle(date) || ''
if (newTitle) this.setAttribute('title', newTitle)
if (newTitle && !this.noTitle) this.setAttribute('title', newTitle)
}

const duration = elapsedTime(date, this.precision, now)
Expand Down

0 comments on commit 257f0eb

Please sign in to comment.