Re: [mochikit] Providing patch for ticket #361

2010-02-22 Thread Per Cederberg
Thanks for the patches, Niek! They've now been applied to svn trunk.

Cheers,

/Per

On Fri, Feb 19, 2010 at 09:32, Niek Kouwenberg
niek.kouwenb...@gmail.com wrote:
 Okay,

 Attached you'll find 361.patch for bug #361.
 I also added a patch for bug #246, which was fairly simple.


 On Thu, Feb 18, 2010 at 5:37 PM, Bob Ippolito b...@redivi.com wrote:

 You can send it here to the list

 On Thu, Feb 18, 2010 at 3:18 AM, niek.kouwenb...@gmail.com
 niek.kouwenb...@gmail.com wrote:
  Hi,
 
  I've just created a ticket for which I have a patch. Since editing and
  replying to tickets seems to be disabled since 2008, I have no way of
  attaching this patch.
 
  Since I've been using MochiKit quite some time now in several
  projects, I am keen on helping a little with development (which seems
  rather slow). Not being able to provide patches or comment to tickets
  seems to make this really hard and might kill MochiKit future.
 
  Where do I send my patch?
 
  --
  You received this message because you are subscribed to the Google
  Groups MochiKit group.
  To post to this group, send email to mochi...@googlegroups.com.
  To unsubscribe from this group, send email to
  mochikit+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/mochikit?hl=en.
 
 

 --
 You received this message because you are subscribed to the Google Groups
 MochiKit group.
 To post to this group, send email to mochi...@googlegroups.com.
 To unsubscribe from this group, send email to
 mochikit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/mochikit?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochi...@googlegroups.com.
To unsubscribe from this group, send email to 
mochikit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en.



[mochikit] Patch for ticket #329

2010-02-22 Thread Niek Kouwenberg
MochiKit.Base.serializeJSON fails for objects with a 'length' property

This method used an 'is array like'-like check, instead of a strict 'is
array' check. The provided patch replaces the if-statement with the isArray
checks as implemented in Prototype.js and jQuery. This does not break
existing functionality, but prevents the errors for objects with a lenght
property. These are now correctly added to the JSON string as objects.

-- 
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochi...@googlegroups.com.
To unsubscribe from this group, send email to 
mochikit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en.



329.patch
Description: Binary data


Re: [mochikit] Patch for ticket #329

2010-02-22 Thread Per Cederberg
I think the proper type check would be better written as o instanceof Array.

Also, previously we've been very cautious with breaking backwards
compatibility. The existing code supports JSON-serialization of
array-like structures, something that wouldn't be supported by the new
code. Perhaps we could just recommended native JSON.stringify() for
most cases:

  https://developer.mozilla.org/En/Using_native_JSON

So, the question is if we should switch to strict JSON in the
serializeJSON() method? Or just deprecate our version now that all
major browers support JSON.stringify(). Any opinions on the list?

Cheers,

/Per

On Mon, Feb 22, 2010 at 14:00, Niek Kouwenberg
niek.kouwenb...@gmail.com wrote:
 MochiKit.Base.serializeJSON fails for objects with a 'length' property

 This method used an 'is array like'-like check, instead of a strict 'is
 array' check. The provided patch replaces the if-statement with the isArray
 checks as implemented in Prototype.js and jQuery. This does not break
 existing functionality, but prevents the errors for objects with a lenght
 property. These are now correctly added to the JSON string as objects.

 --
 You received this message because you are subscribed to the Google Groups
 MochiKit group.
 To post to this group, send email to mochi...@googlegroups.com.
 To unsubscribe from this group, send email to
 mochikit+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/mochikit?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochi...@googlegroups.com.
To unsubscribe from this group, send email to 
mochikit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en.



[mochikit] Re: Patch for ticket #329

2010-02-22 Thread Niek Kouwenberg
I see.

In that case we can just try to serialize the JSON string for an array-like
object, and on failure (incorrect length property) fallback to the
object-like serialization.

A simple try-catch will fix this. I've attached a different patch which is
backward compatible and fixes this bug.

-- 
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochi...@googlegroups.com.
To unsubscribe from this group, send email to 
mochikit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en.



329_2.patch
Description: Binary data