Obviously it's up to the developers as to when to deprecate and when to remove, but I'm wondering how to warn developers that a JavaScript function has been deprecated?
Some popular languages (Java, C#, Python) support language level deprecation in some form.
For JavaScript though, I cannot find any standard way that developers can indicate a function has been deprecated (in code). The best I can do is follow (a large number of) release notes.
As an example, grepping the full source of jQuery 1.8 shows minimal inline comments:
# curl http://code.jquery.com/jquery-1.8.0.js | grep -i depre
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
// *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
// Some plugins are using, but it's undocumented/deprecated and will be removed.
// Deprecated
// Limit scope pollution from any deprecated API
// Deprecated, use jQuery.browser.webkit instead
W3C and MDN don't seem to have a standard way or provide suggestions on how to handle this.
The best I've found is JSDoc's @deprecated
tag.
Does anyone know if JavaScript does have a deprecation annotation that I've overlooked? Are there better or more common ways to do this?