Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor optimizations + title feature #34

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

philfreo
Copy link

If you want only some of these commits, feel free to cherry-pick them (e.g. if you want to build it yourself)

philfreo added 4 commits May 15, 2014 17:10
…the element.

(Only happens the first time we wipe the original text, and only if a
'title' wasn't already set).

This allows your original HTML (before JS runs) to have a human readable date like
"April 11, 2014" and then have smart-time-ago make it say "1 month ago"
but then the user can still hover their mouse to see the more detailed/accurate
format of the date.
<time class="timeago" datetime="2014-04-11">April 11, 2014</time>

Of course, a tooltip could be done already without these changes if you make the
original HTML like this:
<time class="timeago" datetime="2014-04-11" title="April 11, 2014">April 11, 2014</time>
However having the 'title' before the text has changed is redundant, and not in the
spirit of JS gracefully enhancing the page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant