bitovi/canjs — pull request #429 by ccummings (2013-06-13 07:10:24+00:00)
Title: can.sub should return null if value is undefined or null

Currently can.sub only returns null if the property it is trying to replace is `undefined`. It should do the same if the value is null.

This bug rears its ugly head in can.Control when templated event handlers get parsed.

Say you have a compute named `val1` in your defaults which is `null` and you have a templated event that looks like `'{val1} change`. When can.sub is run on that string and the options you get `' change'` which will setup a binding on the Control's element for any change event from the DOM (from form elements).

So in this case, you get this very weird behavior of having the handler for a compute change run when form elements are updated.

Example fiddle: http://jsfiddle.net/jCjBw/1/