In the following HTML, both <bdi> and <span dir="auto"> seem to behave the same:
<p dir="auto">
<bdi>ABC תתת DEF</bdi>
אבג דהו.
</p>
<p dir="auto">
<span dir="auto">ABC תתת DEF</span>
אבג דהו.
</p>
I could not find any case where they behave differently, so my question is:
Is there any difference between them? Is there ever a reason to use <bdi> over dir="auto"? Especially if I want to apply it to an element that already exists in my HTML, for example <a>:
<p dir="auto"><a href="http://example.com" dir="auto">http://example.com</a> טקסט טקסט</p>
<p dir="auto"><bdi><a href="http://example.com">http://example.com</a></bdi> טקסט טקסט</p>
The version with <bdi> has some unnecessary nesting.
If dir="auto" accomplishes the same thing, then why does <bdi> exist?