This project is archived and is in readonly mode.

#651 ✓resolved
gonchuki

Class.toString broken on 1.2.2 (big regression)

Reported by gonchuki | April 30th, 2009 @ 09:22 PM | in 1.3.0 rc2 (closed)

seems I got into a big gotcha of some new code you inserted in both 1.2.1 and 1.2.2 it seems to be a big regression, partially introduced in 1.2.1 and completely broken in 1.2.2

the issue:

basically, if you have a toString function in your class, it breaks if said class has a constructor.

the code:


var Test = new Class({
  initialize: function() {
    // empty function also breaks
  },
  toString: function() {
    return 'foo';
  }
});

var testvar = new Test();

1.2.0

console.log(testvar.toString())
~ foo

console.log(testvar.toString)
~ function()

1.2.1

console.log(testvar.toString())
~ Function.prototype.toString called on incompatible object

console.log(testvar.toString)
~ toString()

1.2.2

console.log(testvar.toString())
~ testvar.toString is not a function

console.log(testvar.toString)
~ [object Function]

also important to know, removing the constructor from the class breaks the same way in 1.2.2 but works in 1.2.1 as it did in 1.2.0

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Pages