Unnecessary spaces when rendering list controls

N

Nathan Sokalski

When a DropDownList is rendered, the <option> tags are all rendered on
separate lines, as follows:

<option value="mon">Monday</option>
<option value="tues">Tuesday</option>
<option value="wed">Wednesday</option>
<option value="thur">Thursday</option>
<option value="fri">Friday</option>

Notice that each <option> tag is not only on its own line, but is indented
as well. Why is this extra space rendered? It increases the download size of
the page (maybe only a little, but if a page has a lot of DropDownLists with
a lot of options, such as a page with multiple DropDownLists for states, it
can be a lot) for no reason (at least not that I know of). Is there any easy
way to avoid this extra space? I'm not trying to complain, I just don't see
the point in increasing download size for no reason.
 
C

Carlo Pagano

Excellent question, I've been looking into this and I can't understand why
such "overhead" is introduced. I have a project which has a bunch of
dropdownlists on a certain page and the increased download size is ridiculous.
 
J

JM

I'm not trying to complain, I just don't see the point in increasing
download size for no reason.

Quite simply human readability.

The parser processing the page could care less..

John
 
N

Nathan Sokalski

In the case of most controls that render multiple tags (which I realize is a
large percentage of them) I would agree, but for a simple
<select><li></li></select>, for example (with multiple li's, of course),
it's not that hard to read since thare are rarely any nested tags. Also, if
human readability is the issue, you still don't need to indent them, just
put them on separate lines. For most tags (where there is just an opening
and closing, possibly with nested, and the opening/closing may be many lines
apart), indentation may be more important for human readability. And there
is no reason there couldn't be a property in the base list class that allows
you to choose.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,017
Latest member
GreenAcreCBDGummiesReview

Latest Threads

Top