Permalink
Browse files

fix for when an element is passed to the programatic timeago helper

  • Loading branch information...
1 parent 8e1c250 commit c03993e2d0861dd3d00e00bfb613dca614dafcb1 @rmm5t rmm5t committed Jul 30, 2008
Showing with 3 additions and 3 deletions.
  1. +1 −1 jquery.timeago.js
  2. +2 −2 test.html
View
@@ -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, {
View
@@ -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>

0 comments on commit c03993e

Please sign in to comment.