In the upcoming Summer '12 Salesforce release, one of the new features is a layout attribute for Apex component tags. This new layout feature allows you to wrap your components in a div or span tag. The full definition can be found in the release notes under "Visualforce Enhancements". It states that the default value for the new attribute is "inline" (span tag), so any existing component where this attribute does not exist should be unaffected, as is the Salesforce release way.
However, I have found in some cases that this new attribute has had an adverse affect on the appearance of Visualforce pages and email templates that leverage components.
For example, if you have an email template that that has a text attachment defined in Visualforce, and that definition has components included, span tags will now appear as part of the attachment. Take this simple email template and component definition.
Visualforce Email Template:
<messaging:emailTemplate subject="Sample Email With Text Attachment" recipientType="Contact" > <messaging:plainTextEmailBody > Wow look at this attachment, It's nearly as amazing as hoverboards! </messaging:plainTextEmailBody> <messaging:attachment renderAs="text/plain" filename="test.txt"> Hi {!recipient.Name}, Here is your awesome text! <c:TextComponent /> </messaging:attachment> </messaging:emailTemplate>
Visualforce Compnent Defintion:
<apex:component access="global"> Text from a component, YES! YES! YES! </apex:component>
If an email message using this template is sent out this is how it appears in the recipient inbox if the Salesforce Org uses the Summer '12 release:
Here is the text attachment. As you can see it contains span tags, which is not what was intended. The same template would not have produced these tags in previous releases.
The way to resolve this is simple, just add the new layout attribute to the apex component definition, with a value of "none".
<apex:component access="global" layout="none"> Text from a component, YES! YES! YES! </apex:component>
Now when an email using this template is sent, the email attachment looks like we want:
Summer '12 is currently in sandbox orgs, but will be promoted to all orgs over the next few weeks. My advice would be to identify the pages and templates where components are used before the release, making sure they still behave as intended. If they don't, add the layout attribute with a value of "none" as above.