How do I replicate Gmail's "to" field where each item is an indivisible span? : <p>I want to replicate the functionality of Gmail's "to" field where:</p>

<ul>
<li>Each address is actually a div or span containing information</li>
<li>The user treats each email address as an atomic, indivisible element -- e.g. backspace will delete it with backspace</li>
<li>Elements are added by autocomplete. The implementation of autocomplete is outside of scope of this question. It's only here to clarify that an element is not just "text".</li>
</ul>

<p>Initially, I thought it should be a contenteditable element. However, inspecting Gmail's elements more closely, it looks to me like it's an element that just responds to keydown events</p>

<p>Is there an accepted, easy way to do this, other than implementing the element (as well as key navigation) by hand?</p>
