Error if message is a String, not just literal.
uruz opened this issue · 2 comments
I'm getting error Error: NOT_FOUND_ERR: DOM Exception 8
if passed message is not a string literal, but instance of String "class". Example: http://jsfiddle.net/uyKf2/1/
Looks like this is a coming from jQuery itself. Example: http://jsfiddle.net/FvuGv/
I think what's happening is that if you pass an object to jQuery append, it thinks you're passing in an element instead of a string. The error happens because it tries searching the DOM for something that doesn't exist.
What's your use case for using an instance of String over a literal?
I could change it to .text() instead of .append(), but then you wouldn't be able to pass in html or other jQuery objects.
My case was parsing JSON, result of that contains instances of strings. Anyway, I've solved it with .toString().