mirror of
https://github.com/scratchfoundation/jquery-timeago.git
synced 2025-02-17 00:20:32 -05:00
fix for when an element is passed to the programatic timeago helper
This commit is contained in:
parent
8e1c2502e3
commit
c03993e2d0
2 changed files with 3 additions and 3 deletions
|
@ -17,7 +17,7 @@
|
|||
$.timeago = function(timestamp) {
|
||||
if (timestamp instanceof Date) return inWords(timestamp);
|
||||
else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp));
|
||||
else return inWords($.timeago.parse(timestamp.title));
|
||||
else return inWords($.timeago.parse($(timestamp).attr("title")));
|
||||
};
|
||||
|
||||
$.extend($.timeago, {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
// unit tests
|
||||
$("#helper_date").text($.timeago(new Date()));
|
||||
$("#helper_string").text($.timeago(iso8601(new Date())));
|
||||
$.timeago($("#helper_element"));
|
||||
$("#helper_element").text($.timeago($("#helper_element")));
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
|
@ -92,6 +92,6 @@
|
|||
<h1>Helper unit tests:</h1>
|
||||
You opened this page <abbr id="helper_date"></abbr> [won't refresh]<br />
|
||||
You opened this page <abbr id="helper_string"></abbr> [won't refresh]<br />
|
||||
You opened this page <abbr id="helper_element" class="loaded"></abbr> [should refresh]<br />
|
||||
You opened this page <abbr id="helper_element" class="a loaded"></abbr> [won't refresh]<br />
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue