Skip to content
Snippets Groups Projects
Commit d4be3f96 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

Deprecation marker for JavaScript functions

This adds a DEPRECATED() JavaScript function. This function will print a
warning to the Browser's debug console if available (Chrome and Firefox
with Firebug extension) when ever it is called.

The DEPRECATED() function was also added to the $() function which
should no longer be used and be replaced with JQuery calls.

Other deprecated functions need to be identified and marked.
parent e91ea5c1
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,32 @@ if ('function' === typeof jQuery && 'function' === typeof jQuery.noConflict) {
jQuery.noConflict();
}
/**
* Mark a JavaScript function as deprecated
*
* This will print a warning to the JavaScript console (if available) in
* Firebug and Chrome and a stack trace (if available) to easily locate the
* problematic function call.
*
* @param msg optional message to print
*/
function DEPRECATED(msg){
if(!console) return;
if(!arguments.callee) return;
var func = arguments.callee.caller.name;
var line = 'DEPRECATED function call '+func+'(). '+msg;
if(console.warn){
console.warn(line);
}else{
console.log(line);
}
if(console.trace) console.trace();
}
/**
* Some of these scripts were taken from wikipedia.org and were modified for DokuWiki
*/
......@@ -30,6 +56,8 @@ if (clientPC.indexOf('opera')!=-1) {
* @link http://prototype.conio.net/
*/
function $() {
DEPRECATED('Please use the JQuery() function instead.');
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment