Ticket #3077: 3077.patch

File 3077.patch, 1.6 KB (added by Garry Yao, 15 years ago)
  • _source/core/tools.js

     
    387387                {
    388388                        return function() { return func.apply( obj, arguments ); };
    389389                },
    390 
     390               
     391                /**
     392                 * Class creation based on prototype inheritance, with supports of the
     393                 * following features:
     394                 * <ul>
     395                 * <li> Static fields </li>
     396                 * <li> Private fields </li>
     397                 * <li> Public(prototype) fields </li>
     398                 * <li> Chainable base class constructor </li>
     399                 * </ul>
     400                 *
     401                 * @param {Object} definiton (Optional)The class definiton object.
     402                 */
    391403                createClass : function( definition )
    392404                {
    393                         var $ = definition.$,
     405                        definition = definition || {};
     406                        var $ = definition.$ || function(){},
    394407                                baseClass = definition.base,
    395408                                privates = definition.privates || definition._,
    396409                                proto = definition.proto,
     
    401414                                var originalConstructor = $;
    402415                                $ = function()
    403416                                {
    404                                         originalConstructor.apply( this, arguments );
    405                                        
    406417                                        // Create (and get) the private namespace.
    407418                                        var _ = this._ || ( this._ = {} );
    408419                                       
     
    415426                                                _[ privateName ] =
    416427                                                        ( typeof priv == 'function' ) ? CKEDITOR.tools.bind( priv, this ) : priv;
    417428                                        }
     429                                       
     430                                        originalConstructor.apply( this, arguments );
    418431                                };
    419432                        }
    420433
     
    421434                        if ( baseClass )
    422435                        {
    423436                                $.prototype = this.prototypedCopy( baseClass.prototype );
     437                                $.prototype.constructor = $;
    424438
    425439                                $.prototype.base = function()
    426440                                {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy