Fix accessing timestamps when stored only as a property.

Review Request #14397 — Created April 10, 2025 and updated — Latest diff uploaded

Information

jquery-timesince
master

Reviewers

When jquery-timesince was first released, $.fn.attr() would look at
both attributes and properties, but this has since changed. If we have a
<time> element with datetime set as a property and not as an
attribute, it would come up empty.

This will now check the attribute first, for backwards-compatibility,
and fall back on trying to access it from the property.

Verified this fixed an issue with a manually-constructed <time> element.

Diff Revision 1

This is not the most recent revision of the diff. The latest diff is revision 2. See what's changed.

orig
1
2

Commits

First Last Summary ID Author
Fix accessing timestamps when stored only as a property.
When jquery-timesince was first released, `$.fn.attr()` would look at both attributes and properties, but this has since changed. If we have a `<time>` element with `datetime` set as a property and not as an attribute, it would come up empty. This will now check the attribute first, for backwards-compatibility, and fall back on trying to access it from the property.
c8b6e9b205c80c1f3919689731641c20da512f86 Christian Hammond
NEWS.md
jquery.timesince.js
Loading...