TrID in facts isn't very well suited for analyzing text files.
It can get away sometimes with good results, but it depend on a lots of factors. Very "free form" filetypes (like both HTML and JavaScript sources) are among the most easy to cause misidentification.
A file identifier for text files would have been designed in a very different way. Probably a next verision of TrID (or a different tool) will handle that too.
Thanks for your feedback,
Bye!