Insert a zero-width joiner (e.g. using the entity reference ‍
) at the end of the span
element content: <span>ش‍</span>س
.
More generally, the zero-width joiners at the start and end of each span
element as well as (just to be more sure) before and after each span
element, in situations where the text should have cursive (joining) behavior and span
may break it.
The issue is discussed and illustrated on the Bidirectional text page by Andreas Prilop.
Update: Unfortunately, it seems that even ‍
does not help on current versions of WebKit browsers. They seem to treat HTML markup as breaking joining behavior, no matter what.
Update 2: As described in @NasserAl-Wohaibi’s comment, the new problem can be solved by using ‍
twice. However, in current Safari (5.1.7) for Windows, it does not help; in fact, it displays even ش‍س
wrong whereas without the joiner, it shows شس
correctly.