Custom tags generating HTML IDs

2 views
Skip to first unread message

Tony Nelson

unread,
Jun 28, 2011, 6:35:06 PM6/28/11
to ColdMVC
I've been thinking about cleaning up some of the markup that's
generated by the custom tags. I'd like for the generated HTML to be as
minimal and yet useful as possible.

Right now, if you have a <c:input name="firstName" />, the following
HTML will be generated:

<div class="wrapper" id="wrapper_for_firstName">
<div class="label">
<label id="label_for_firstName" for="firstName"
title="First Name">First Name:</label>
</div>
<div class="field">
<input type="text" name="firstName" id="firstName"
title="First Name" value="" />
</div>
</div>

You'll notice that ColdMVC automatically generates unique IDs for the
wrapper and label.

I thought the IDs might come in handy when performing tasks such as
validation, but you can get at the tags relatively easily by
traversing the DOM. For example, $
('#firstName').closest('div.wrapper').find('label').

Do you guys find these IDs useful, or can I remove them?

If you feel I shouldn't remove them, can I at least disable them by
default and allow them to be enabled by adding a config setting like
coldmvc.html.generateIDs = true or something along those lines?

Let me know your thoughts, especially since this change would break
backwards compatibility and I don't want to screw anybody over. :)

-Tony




Tony Nelson

unread,
Jul 1, 2011, 9:57:53 AM7/1/11
to ColdMVC
Bueller?

Ryan Ricard

unread,
Jul 1, 2011, 10:07:22 AM7/1/11
to ColdMVC
I'm fine with the IDs being removed and vote against the config
setting.

Tony Nelson

unread,
Jul 1, 2011, 8:04:59 PM7/1/11
to ColdMVC
Sweet. Done.
Reply all
Reply to author
Forward
0 new messages