prototype: Ensure that classes always have an initialize method.
This commit is contained in:
parent
6086db40a7
commit
001b54865c
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Ensure that classes always have an initialize method. [Mislav Marohnić]
|
||||
|
||||
* Update Template, Selector, Ajax.*, and ObjectRange classes to use the new class system. [Mislav Marohnić]
|
||||
|
||||
* Change Abstract.TimedObserver to subclass PeriodicalExecuter and tweak its subclasses to use new inheritance functionality. TimedObserver can now be stopped the same way as PeriodicalExecuter. Closes #8589. [Mislav Marohnić]
|
||||
|
|
|
@ -21,6 +21,9 @@ var Class = {
|
|||
}
|
||||
|
||||
if (properties) Class.extend(klass, properties);
|
||||
if (!klass.prototype.initialize)
|
||||
klass.prototype.initialize = Prototype.emptyFunction;
|
||||
|
||||
klass.prototype.constructor = klass;
|
||||
|
||||
return klass;
|
||||
|
|
|
@ -415,6 +415,9 @@
|
|||
assertEqual('Nibbles: Hi!', pet.say('Hi!'));
|
||||
assertEqual(Animal, pet.constructor, "bad constructor reference");
|
||||
assertUndefined(pet.superclass);
|
||||
|
||||
var Empty = Class.create();
|
||||
assert('object', typeof new Empty);
|
||||
}},
|
||||
|
||||
testInheritance: function() { with(this) {
|
||||
|
|
Loading…
Reference in New Issue