.escape should return null instead of "" if the attribute is null.#1227
.escape should return null instead of "" if the attribute is null.#1227markbates wants to merge 1 commit into
Conversation
|
Hmm, I can see both sides of this one. If On the other hand, its inconsistent with underscore. This change could have significant impact on existing apps. |
|
Yeah, there are definitely two sides to this one. In regards to printing values, if you try to print a JavaScript null to HTML it prints an empty string, so that's not going to be an issue with existing apps. The place where it could be an issue with existing apps is if you're concatenating a null and a string. That would result in something like "nullfoo". |
|
This goes right along with jashkenas/underscore#556 and jashkenas/underscore#559. Whatever the decision is, I think these issues should be handled consistently. |
|
Why would you check the existence of an attribute after escaping it? The |
The .escape function on Backbone.Model is returning an empty string if the attribute value is null. It should return null to match the original value. This can cause issues where you're checking the existence of an attribute before acting on it.