[SalesForce] outputField, long textarea field and unwanted spaces

I am having trouble with apex:outputField and a long textarea field. Salesforce appears to be inserting extra spaces on lines after BR tags after the page is rerendered following an actionFunction.

Here is the text exactly as it appears within the long textarea field:

The following questions and requirements are needed to continue your on-boarding. Once you have finished, you will have access to our system for client and resource management.

1. Fill in some demographic information
2. Sign the advocate handbook

If you have any questions, please contact your Program Manager.

Welcome to the team!

Everything is flush against the left margin.

The text appears correctly when the Visualforce page is first invoked. However, after an actionFunction rerender, the spaces are inserted.

Here is the resulting HTML after apex:outputField:

<span id="blah blah blah">
The following questions and requirements are needed to continue your on-boarding. Once you have finished, you will have access to our system for client and resource management.
<br>
<br>
 1. Fill in some demographic information
<br>
 2. Sign the advocate handbook
<br>
<br>
 If you have any questions, please contact your Program Manager.
<br>
<br>
 Welcome to the team!
</span>

Note that all the text lines after BR tags are indented by a space. This causes problems because we are also using Markdown to do some extra formatting for this div.

Anyone know how I can eliminate those extra spaces? I've already tried outputText but that does not suit our needs.

Thanks

David

Best Answer

Is it possible that something else on the page is altering the DOM?

I tried the following.

  1. Added a custom Long Text Area field to Account with the API name TestLongTextArea__c
  2. Created a Visualforce Page with the content.

    <apex:page standardController="Account"> <apex:outputField value="{!account.TestLongTextArea__c}" /> </apex:page>

  3. Loaded your test data into the custom field for a random Account.

  4. Previewed the Visualforce page and added the Id query string parameter with the value from step 3.
  5. Used view page source in chrome.

Page source

The same content in Notepad++ so I can see the EOL chars:

enter image description here

Looks right to me. What OS and browser are you using? It might be something odd with the carriage returns and line feeds.