On 9 Apr 2015, at 05:10, Mel Adamaitis <melissamat...@gmail.com> wrote: > > Problem: > In an XMPP IM client we are working on, it is necessary for mentions of other > users (for alerting, highlighting) to be based on a normalised user identity, > but displayed in a denormalized human-readable format. Additionally, for a > particular denormalized identity, there may be any number of normalised > identities. For example, user j...@example.com should be mentioned as Joe > Bloggs. The relationship between the normalized and denormalized identities > is known by the client authoring the message, and must be transmitted with > the message for appropriate display and behaviour on the receiving end. > > Requirements: > • Allow a denormalized username to show up as highlighted/special when > displayed in the client-side, up to and including unique selection in the DOM > (for JavaScript). > • Allow more than one denormalized username per message. > • Allow non-unique denormalized username displays. > • Continue to allow more text either before, after, or between mentions > so that mentions can fit in with normal conversation flow. > > Current Solution: > XEP-0071 allows for the <span> tag to have the following attributes: id, > class, name, and style. We could misappropriate these attributes and do > something like <span class=”user-mention” title=”#ID#”>John Smith</span>. > Complex data would have to be serialized somehow, and if you need to > genuinely use all of the standard attributes currently allowed, there are > none left to misappropriate. > > Proposed Solution: > Update XEP-0071 to XHTML5 to allow the use of data-* attributes within > elements. > > Does anyone see a flaw with this approach, or have an alternative suggestion > which meets the requirements and/or which is already in use for similar > functionality?
I have two immediate thoughts (although maybe 8am isn’t the best time to try to think). 1) I’m not sure that adding data-* to XEP-0071 would aid interoperability, as the use of the data-* needs to be understood by both ends (e.g. in your case it isn’t enough for xep71 to just say ‘you can use data-*’, because a third-party client receiving your data-* markup wouldn’t understand what to do with it). 2) As you’re controlling the clients at both end, I can’t immediately see any problem with just shipping data-* attributes inside the generated XHTML, although -71 says not to. The importance of following the specs is to ensure you can interop fully; if you’re controlling the clients at both ends and need special logic to do so you can add non-standardised markup reasonably safely. I’m not sure if others will agree or disagree with me here. /K