<!DOCTYPE html>
<style>
.atomic { display: inline-block; }
</style>
<body>
<div dir="rtl">
<span>
<span>Hello<br>World<br></span>
<span class="atomic"></span>
</span>
</div>

<div dir="rtl">
<span dir="ltr">
<span>Hello<br>World<br></span>
<span class="atomic"></span>
</span>
</div>
</body>
