Results 1 to 5 of 5

Thread: A strange object ?

Threaded View

  1. #1
    Join Date
    Oct 2010
    Versailles, France

    A strange object ?

    I am not an expert with classes and objects and I would like to understand this structure from Brian Kirchoff (see the attached text file coming from the site niceEditor )
    var bkExtend = function(){
    	var args = arguments;
    	if (args.length == 1) args = [this, args[0]];
    	for (var prop in args[1]) args[0][prop] = args[1][prop];
    	return args[0];
    function bkClass() { };// One empty class
    bkClass.prototype.construct = function() {};// With one empty function construc
    bkClass.extend = function(def) {
      var classDef = function() {       
          if (arguments[0] !== bkClass) { return this.construct.apply(this, arguments); }
      var proto = new this(bkClass);
      classDef.prototype = proto;
      classDef.extend = this.extend;
      return classDef;
    Then bkClass.extend is used along the script to build the Editor...
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center