@@ -36,7 +36,7 @@ Base.inject(/** @lends Base# */{
3636 */
3737 toString : function ( ) {
3838 return this . _id != null
39- ? ( this . constructor . name || 'Object' ) + ( this . _name
39+ ? ( this . _class || 'Object' ) + ( this . _name
4040 ? " '" + this . _name + "'"
4141 : ' @' + this . _id )
4242 : '{ ' + Base . each ( this , function ( value , key ) {
@@ -87,7 +87,7 @@ Base.inject(/** @lends Base# */{
8787 // Override Base.extend() to register named classes in Base.exports,
8888 // for deserialization and injection into PaperScope.
8989 var res = extend . base . apply ( this , arguments ) ,
90- name = res . name ;
90+ name = res . prototype . _class ;
9191 if ( name )
9292 Base . exports [ name ] = res ;
9393 return res ;
@@ -300,7 +300,7 @@ Base.inject(/** @lends Base# */{
300300 if ( ! ref ) {
301301 this . length ++ ;
302302 var res = create . call ( item ) ,
303- name = item . constructor . name ;
303+ name = item . _class ;
304304 // Also automatically insert class for dictionary
305305 // entries.
306306 if ( name && res [ 0 ] !== name )
@@ -317,7 +317,7 @@ Base.inject(/** @lends Base# */{
317317 // If we don't serialize to compact form (meaning no type
318318 // identifier), see if _serialize didn't already add the class,
319319 // e.g. for classes that do not support compact form.
320- var name = obj . constructor . name ;
320+ var name = obj . _class ;
321321 if ( name && ! compact && ! res . _compact && res [ 0 ] !== name )
322322 res . unshift ( name ) ;
323323 } else if ( Array . isArray ( obj ) ) {
@@ -326,7 +326,7 @@ Base.inject(/** @lends Base# */{
326326 res [ i ] = Base . serialize ( obj [ i ] , options , compact ,
327327 dictionary ) ;
328328 // Mark array as compact, so obj._serialize handling above
329- // doesn't add the constructor name again.
329+ // doesn't add the class name again.
330330 if ( compact )
331331 res . _compact = true ;
332332 } else if ( Base . isPlainObject ( obj ) ) {
0 commit comments