Skip to content

Commit 257f0eb

Browse files
authored
fix: Move 'noTitle' conditional.
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.
1 parent 534ce30 commit 257f0eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/relative-time-element.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,9 @@ export class RelativeTimeElement extends HTMLElement implements Intl.DateTimeFor
440440
return
441441
}
442442
const now = Date.now()
443-
if (!this.#customTitle && !this.noTitle) {
443+
if (!this.#customTitle) {
444444
newTitle = this.#getFormattedTitle(date) || ''
445-
if (newTitle) this.setAttribute('title', newTitle)
445+
if (newTitle && !this.noTitle) this.setAttribute('title', newTitle)
446446
}
447447

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

0 commit comments

Comments
 (0)