1
0
Fork 0

Ensured __initProps() is treated as a reserved method and cannot be declared within Classes

closure/master
Mike Gerwitz 2010-12-16 23:55:56 -05:00
parent a60fe9c2de
commit a06d9a7204
2 changed files with 19 additions and 0 deletions

View File

@ -96,6 +96,17 @@ var extend = ( function( extending )
var properties = {};
util.propCopy( props, prototype, result_data, {
each: function( name, value )
{
// disallow use of our internal __initProps() method
if ( name === '__initProps' )
{
throw new Error( "__initProps is a reserved method" );
}
this.performDefault( name, value );
},
property: function( name, value )
{
properties[ name ] = value;

View File

@ -185,3 +185,11 @@ assert.ok(
"Subtypes can override parent property values"
);
assert.throws( function()
{
Class.extend(
{
__initProps: function() {},
});
}, Error, "__initProps() cannot be declared (internal method)" );