Is it possible to configure an HTML element (custom element or built-in) to be treated like a single text (non-whitespace) character -- that is, it has an implied <nobr> wrapped around itself and adjacent text.
My use case is making certain musical symbols that are treated like text (like the sharp in F# but more complex). So I could write the note F<my-sharp></my-sharp> is nice and know that there would never be a line break between F and <my-sharp>, equivalent to the note <nobr>F<my-sharp></my-sharp></nobr> is nice. The css white-space: nowrap would configure anything inside <my-sharp> but not apply to the F behind it.
I want to avoid the <nobr> solution (which I've already implemented) in part because it breaks encapsulation to have a custom element manipulating the DOM of elements outside of it, and also because I am using this in a contenteditable block, so that if someone adds text after the F, like the note <nobr>F or G<my-sharp></my-sharp></nobr> is nice then the <nobr> is covering whitespace, which isn't intended.
A css attribute like display: inline-character does not seem to exist, but maybe there is another way?
display:inlinefor<my-sharp>?style="display: inline;"on every element, and unfortunately it didn't help; adjacent inline elements can have line breaks between (but thanks for reminding me to triple check that).