Pre-formatted text for all browsers

From Emprise Wiki
Jump to: navigation, search

To make a field pre-formatted and work in all browsers:


Give you container a class of "preformatted", this definition is stored in the standard.css


This references the following CSS:


.preformatted {

font-family:"courier new" !important; /* Text aligns as expected */
white-space: pre-wrap ; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre; /* Internet Explorer 5.5+ */
word-wrap: break-word; /* Internet Explorer 5.5+ */

}


If trying to populate the containers from a SOAP request response use "innerText" instead of "innerHTML" for all IE browsers. Ext has an isIE property to help:


document.getElementById("PreformattedContainer")[ Ext.isIE ? 'innerText' : 'innerHTML' ] = myRequest.responseText);