oliver-moran/pomade.js — pull request #1 by mbrowne (2014-05-09 22:56:30+00:00)
Title: Added support for cyclic references to prevent infinite loop

This is a great little library, but unfortunately if you have cyclic references in your model, it will cause an infinite loop! For example:

var model = {};

var child = {};
var grandchild = {};

// Child references down to grandchild
child.parent = null;
child.child = grandchild;

// Grandchild references back up to child
grandchild.parent = child;
grandchild.child = null;

model.thing = child;

So I modified _clone() and _isIdenticalTo() to check for cyclic references. I also noticed that when _clone() clones arrays, they are not real arrays afterwards but I'm guessing that doesn't matter since it looks like _clone() is only being used in to compare bindings. So I think the _clone() method supports all it needs to now but FYI I have a more robust deepCopy() method in my simpleoo library:
https://github.com/mbrowne/simpleoo.js/blob/master/simpleoo.js

Thanks,
Matt