Stop bloating my code!

While testing out some of the cool new featuers in SharePoint 2007 Beta 2 Technical Refresh, I noticed there is a lot of code-rewriting going on when you use the HTML editing features built into the new WCM content-editing control.

For example:

I wrote a simple inline style to add some padding to a DIV – I took full advantage of CSS shorthand while specifying my properties but unfortunately the editor decided “it knows best” – and took:

<div style=”padding:10px;”>My div</div>

and turned it into

<div style=”
PADDING-LEFT:10px;
PADDING-RIGHT:10px;
PADDING-TOP:10px;
PADDING-BOTTOM:10px;> My Div</div>

While I assume the reasoning for this is the average user may not be HTML literate, I would assume most people opting to use this feature are more like myself and relatively well versed in writing leaner, more semantic HTML. If you are like me you probably utter profanities at any editor that feels the need to change your code.

If you feel you absolutely must have the code-changing option available at least give me the option to say “no thanks” – and if you can’t do that, then at least do it right.

Maybe I am missing something here? Is there an issue with using CSS shorthand inline? I rarely ever use inline code – this was a throw-away example.
/end-rant

3 comments on “Stop bloating my code!

  1. Hagrin says:

    This actually happens in Visual Studio 2003 as well and is highly annoying.

  2. Dan says:

    I agree that it is somewhat annoying that it does that, however padding:10px; really is shorthand for the four edges… so I guess you could say that it’s doing sometihng that is annoying but at the same time just making everything defined.

  3. A Bird says:

    Interesting find. I hope this is fixed in the release! Nonsemantic markup is a scary party of sharepoint 07 – I really wish they would give more control as to how markup is rendered.

Leave a Reply