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

function(elem) doesn't check for null values #142

Open
logicminds opened this issue Oct 3, 2013 · 2 comments
Open

function(elem) doesn't check for null values #142

logicminds opened this issue Oct 3, 2013 · 2 comments

Comments

@logicminds
Copy link

The following code breaks when a null value is passed in.
Surrounding with a conditional block will fix this.

isTime: function(elem) {
// jQuery's `is()` doesn't play well with HTML5 in IE
return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time");
} 
@rmm5t
Copy link
Owner

rmm5t commented Oct 3, 2013

Fair enough, but what scenario are you running into where a null value gets passed to this function? Are you using the isTime or datetime function directly outside of the timeago plugin?

@logicminds
Copy link
Author

I am using the timeago function inside my own function that essentially populates DOM objects. I abbreviated my function below.

function setTimeago(stamp){
     value = jQuery.timeago(stamp);
      document.getElementById("someobjectid").innerHTML = value;

}

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

No branches or pull requests

2 participants