prototype: improvements to deprecation.js.

This commit is contained in:
Tobie Langel 2008-02-26 12:53:41 +00:00
parent 54a20847c8
commit 088c049885
3 changed files with 28 additions and 3 deletions

View File

@ -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]

View File

@ -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;
}
}
]);

View File

@ -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;