From 088c04988527950ce4cc48c7a7483abff6534b4b Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Tue, 26 Feb 2008 12:53:41 +0000 Subject: [PATCH] prototype: improvements to deprecation.js. --- CHANGELOG | 6 ++++++ ext/deprecation/deprecation.js | 15 +++++++++++++-- ext/deprecation/deprecation_test.html | 10 +++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 51fd114..5215f29 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +* deprecation extension: mark Class.create() used without arguments as deprecated. [Tobie Langel] + +* deprecation extension: mark Event.unloadCache as removed rather than deprecated. [Tobie Langel] + +* deprecation extension: log everything *but* deprecations with console.error. [Tobie Langel] + * Change deprecation extension to use Firebug's console.warn and console.error. [Andrew Dupont, Tobie Langel] * Make tagName comparisons XHTML-compliant. Closes #11012, #11013, #11014. [cfis, Tobie Langel] diff --git a/ext/deprecation/deprecation.js b/ext/deprecation/deprecation.js index e9596a6..551962c 100644 --- a/ext/deprecation/deprecation.js +++ b/ext/deprecation/deprecation.js @@ -61,7 +61,7 @@ var DeprecationNotifier = { }, log: function(message, type) { - if (type === 'removal') { + if (type !== 'deprecation') { console.error(message); } else console.warn(message); } @@ -295,7 +295,18 @@ DeprecationNotifier.init([ { methodName: 'unloadCache', namespace: Event, - message: 'Event.unloadCache has been deprecated.' + message: 'Event.unloadCache has been deprecated.', + type: 'removal' + }, + + { + methodName: 'create', + namespace: Class, + message: 'The class API has been fully revised and now allows for mixins and inheritance.\n' + + 'You can find more about it here: http://prototypejs.org/learn/class-inheritance', + condition: function() { + return !arguments.length; + } } ]); diff --git a/ext/deprecation/deprecation_test.html b/ext/deprecation/deprecation_test.html index 3824323..1079dd9 100644 --- a/ext/deprecation/deprecation_test.html +++ b/ext/deprecation/deprecation_test.html @@ -212,7 +212,7 @@ testEvent: function(){ with(this) { Event.unloadCache(); - assertDeprecationNotified('Event.unloadCache has been deprecated.') + assertRemovalNotified('Event.unloadCache has been deprecated.') }}, testHash: function(){ with(this) { @@ -254,6 +254,14 @@ h.set('toJSON', 'arg'); // make sure hash methods are not overwritten assertRespondsTo('toJSON', h) }}, + + testClass: function(){ with(this) { + Class.create(); + assertDeprecationNotified('The class API has been fully revised and now allows for mixins and inheritance.\n' + + 'You can find more about it here: http://prototypejs.org/learn/class-inheritance'); + Class.create({}); + assertNotNotified(); + }}, testLogDeprecationOption: function(){ with(this) { DeprecationNotifier.logDeprecation = false;