I was working on a bit of script today, and happened upon an interesting happenstance. I was trying to change the text of an element dynamically, and this text needed to include a non-breaking space. My original code seemed to render the entity as text, so this:
elem.setText( '&nbsp;' );
literally printed the text " " instead of the proper entity.
My solution ended up being to change the entity entirely:
elem.setText( '\u00a0' );
The Joomla!® name is used under a limited license from Open Source Matters in the United States and other countries. Jeff Channell is not affiliated with or endorsed by Open Source Matters or the Joomla!® Project.