I recently added a " <ref>" tag in a wikipedia article using the "group=" attribute. After saving the page my browser (Firefox) showed the group name at the end of a line and the number at the beginning of the next line!
Looking at the code I think the bug is located in file "Cite_body.php" in function "linkRef" where line 570 looks like
($group == CITEDEFAULT_GROUP)?'':"$group ").$wgCont....
The space that is added to the group name is a whitespace character in HTML so line-breaking can happen there.
Maybe using a non-breaking space like U+00A0 or U+202F or maybe no space at all would be more appropriate?