JavaScript filter adding non-breakable spaces where necessary.