1602 / compound

MVC framework. Built on Node.JS. Works on server and browser.
http://compoundjs.com
1.6k stars 182 forks source link

Allow override of 'id' attribute when creating form fields #520

Closed mhupman closed 11 years ago

mhupman commented 11 years ago

I'm attempting to override the 'id' attribute of a form input field like so:

<%- form.textarea("content[lefttext][text]", {id: 'override_id'}) %>

However, it appears the safe_merge function in utils.js won't override keys that already exist in the target object, even though the parameters on the calling function, html_tag_params = function(params, override) seem to indicate that they should in fact, override.

Is there any reason we can't drop the check that prevents the overrides?

if (!merge_with.hasOwnProperty(key) || key in merge_what) continue;

to

if (!merge_with.hasOwnProperty(key)) continue;